Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

spring-boot Remove locations attributes from @ConfigurationProperties

Remove locations attributes from @ConfigurationProperties

What are the alternatives?

I've been using it like this before.

@ConfigurationProperties(locations = "a.yml")
like image 532
Minwoo Avatar asked Feb 07 '17 06:02

Minwoo


1 Answers

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.

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/

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/

like image 105
Fabio Maffioletti Avatar answered Oct 21 '22 19:10

Fabio Maffioletti