disconf-demos-java icon indicating copy to clipboard operation
disconf-demos-java copied to clipboard

是否有考虑写个spring-boot-starter-disconf?

Open QiuMing opened this issue 8 years ago • 2 comments

现在项目引进Spring Boot ,之前有使用到disconf ,第一反应就是去查找disconf 的starter,并没有找到,感觉写个startert 会更加方便。

QiuMing avatar Jul 01 '17 04:07 QiuMing

+1

koywang avatar Sep 22 '17 01:09 koywang

如果要写一个starter,默认只需要提供两个配置项,扫描的包scanPackage和托管哪些属性文件locations。

问题是,这两个配置项如果写在application.properties中,就只能在启动之后去拉取。放在启动参数里面,又感觉这两个配置项是代码层面的,和启动参数关系不大。

有一个解决办法是给这个starter单独定义一个本地的配置,不托管给disconf,在disconf启动前手动加载。

补充: SpringBoot本身会定义一个PropertySourcesPlaceholderConfigurer 所以如果要集成的话,可以自定义一个替代掉,然后手动设置setPropertiesArray来加载disconf的ReloadablePropertiesFactoryBean 在启动类上加: @EnableAutoConfiguration(exclude = PropertyPlaceholderAutoConfiguration.class)

fyh avatar Oct 20 '17 01:10 fyh