简体   繁体   English

spring-boot从@ConfigurationProperties删除位置属性

[英]spring-boot Remove locations attributes from @ConfigurationProperties

Remove locations attributes from @ConfigurationProperties 从@ConfigurationProperties删除位置属性

What are the alternatives? 有哪些选择?

I've been using it like this before. 我以前一直在使用它。

@ConfigurationProperties(locations = "a.yml")

Same problem here: we have hundreds of configuration keys on several yaml files, each of them conveniently mapped to a pojo that we inject into our business logic beans. 这里存在同样的问题:我们在多个yaml文件上有数百个配置键,每个配置键都方便地映射到我们注入到业务逻辑bean中的pojo中。

The best thing I could do to upgrade to Spring Boot 1.5 and at the same time keep our production application running without much refactoring is described here: http://fabiomaffioletti.me/blog/2016/12/20/spring-configuration-properties-handle-deprecated-locations/ 此处介绍了我升级到Spring Boot 1.5并能在不进行大量重构的情况下保持生产应用程序运行的最佳方法: http : //fabiomaffioletti.me/blog/2016/12/20/spring-configuration-properties -不赞成使用的位置/

Or, if that does not work for you, you can try this way which is simpler even if requires more refactoring (remove the @ConfigurationProperties annotation): http://fabiomaffioletti.me/blog/2017/02/09/spring-configuration-properties-locations-deprecation-another-approach/ 或者,如果这对您不起作用,即使需要更多的重构,也可以尝试这种更简单的方法(删除@ConfigurationProperties批注): http : //fabiomaffioletti.me/blog/2017/02/09/spring-configuration -属性-位置-弃用-另一种方法/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM