Java Annotation(Java 注解)
发布时间:2020-12-14 06:29:59 所属栏目:Java 来源:网络整理
导读:如果你想知道java annotation是什么?你可以先看看:“” 下面是我做的一个demo: “这样做的目的是什么?“---这里只是做一个demo,让大家知道annotation是怎么一回事儿....在很多我们开发的 过程中,很少用到我们自己定义的注释(Annotation),如果真的用到
如果你想知道java annotation是什么?你可以先看看:“” 下面是我做的一个demo:
“这样做的目的是什么?“---这里只是做一个demo,让大家知道annotation是怎么一回事儿....在很多我们开发的 过程中,很少用到我们自己定义的注释(Annotation),如果真的用到了,那么这篇blog也许就有帮助了..^_^
@
String driver() "com.mysql.jdbc.Driver"
String dbName() ""
String encoding() "UTF-8"
String port() "3306"
String host() "localhost"
String userName() "root"
String password() ""
}
@JDBCAnnotation(dbName = "db_lucene",port = "3306",host = "192.168.0.119",userName = "root",password = "root"
checkInterceptor(Class> cl) flag = cl.isAnnotationPresent(JDBCAnnotation. JDBCAnnotation jdbcAnnotation = cl.getAnnotation(JDBCAnnotation. driver = dbName = encoding = port = host = userName = passwrod = url = "jdbc:mysql://" + host + ":" + port + "/" + dbName + "?characterEncoding=" + System.out.println("JDBCUtil加载注释完成..."
checkInterceptor(JDBCUtil. }
JDBCUtil.driver =
JDBCUtil.dbName =
JDBCUtil.encoding =
JDBCUtil.port =
JDBCUtil.host =
JDBCUtil.passwrod =
|