☆☆☆★☆☆☆

唯有努力才能活成自己想要活成的样子

导航

2020年4月20日 #

java的反射Method

摘要: 开发过程中有时会使用到动态生成一个class,记录下,方便后面开发直接参考 1.在一个bean类中通过反射动态获取调用setter和getter方法(bean中添加下面四个方法) /** *获取类的方法 */ public static Method getGetOrSetMethod(Object 阅读全文

posted @ 2020-04-20 16:55 Yr-Zhang 阅读(779) 评论(0) 推荐(0) 编辑

maven的pom.xml打包配置

摘要: <build> <plugins> <!-- 指定maven编译的jdk版本,如果不指定,maven3默认用jdk 1.5 maven2默认用jdk1.3 --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>mav 阅读全文

posted @ 2020-04-20 16:40 Yr-Zhang 阅读(1464) 评论(0) 推荐(0) 编辑

使用Properties类动态加载配置文件里的内容

摘要: 例如读取配置文件,配置redis, 列出部分代码如下: 1.初始化对象: public class RedisInst { public RedisInst() { } public static IMyRedis getInstance() { FileConf fileConf = FileCo 阅读全文

posted @ 2020-04-20 16:25 Yr-Zhang 阅读(664) 评论(0) 推荐(0) 编辑

org.apache.commons.cli.Options

摘要: 在使用java -jar命令执行包时,使用Options封装一些参数,如下方法中使用: public static void run(String[] args) { if (args.length > 0) { Properties properties = new Properties(); O 阅读全文

posted @ 2020-04-20 16:16 Yr-Zhang 阅读(2674) 评论(0) 推荐(0) 编辑

Google guava和Apache commons

摘要: Guava 是一个 Google 的基于java类库集合的扩展项目,包括 collections, caching, primitives support, concurrency libraries, common annotations, string processing, I/O, 等等 A 阅读全文

posted @ 2020-04-20 15:53 Yr-Zhang 阅读(3397) 评论(0) 推荐(1) 编辑