springboot2读取yml中属性到List<自定义对象>中
1.yml配置
2.实体对象,get,set自己写
3.读取对应list和其他属性
说明:使用
ConfigurationProperties读写,prefix设置dbconfig的根节点。sync_minutes和dblist需和yml文件中名称相同,List类型配置文件中必须对应list[0]、list[1]等等
自定义实体属性也需与yml一致,component注入spring管理bean
4.使用
@Autowired
SyncDBConfig syncDBConfi.
原创
2021-01-07 09:53:13 ·
1502 阅读 ·
0 评论