0
点赞
收藏
分享

微信扫一扫

SpringCloud.04.熔断器Hystrix( Spring Cloud Alibaba 熔断(Sentinel))

f12b11374cba 2024-01-15 阅读 9
java

properties类也是基于流,不算很难,下面直接上代码:

Dog=com.entity.Dog
Cat=com.entity.Cat
Pig=com.entity.Pig
Bird=com.entity.Bird
...
Properties properties = new Properties(); //配置文件读取对象
properties.load(new FileInputStream("path.properties")); //加载配置文件
String ss = properties.get("Person").toString(); //获取KEY所对应的值 即类的全路径
System.out.println(ss);
//通过反射创建对象
//...

关于工厂模式+反射+properties的案例,可以看这篇文件章:Java设计模式之工厂模式

本电子目录: 《Java基础的重点知识点全集》

举报

相关推荐

0 条评论