Spring-Boot 1.4 @ConfigurationProperties location deprecation effects
See original GitHub issueI’m using a custom PropertySourceLoader to decrypt encryped properties via setting
org.springframework.boot.env.PropertySourceLoader
factory.
It works for setting in application.properties
file. For additional files, I normally use @ConfigurationProperties
with setting location
and it also works. But with 1.4, location parameter seem to be deprecated (it works for now). When I use @PropertySource
to lod prop. file, it just load properties without decrypting them.
How can I make sure that all my property files are processed by org.springframework.boot.env.PropertySourceLoader
factory? With the location parameter deprecated, I may need it soon.
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Core Features - Spring
This section dives into the details of Spring Boot. Here you can learn about the key features that you may want to use...
Read more >Spring Boot Reference Guide
Change the location of external properties of an application; 70.4. Use 'short' command line arguments; 70.5. Use YAML for external properties; 70.6.
Read more >Spring Boot Reference Documentation
Try the How-to documents. They provide solutions to the most common questions. Learn the Spring basics. Spring Boot builds on many other Spring...
Read more >Spring Boot Reference Guide
Change the location of external properties of an application; 63.3. Use 'short' command line arguments; 63.4. Use YAML for external properties; 63.5.
Read more >“How-to” Guides - Spring
This is too late to configure certain properties such as logging.* and spring.main.* which are read before refresh begins. 1.4. Build an ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This solution has two drawbacks compared to the deprecated
ConfigurationProperties.locations
:As long as you can get the
PropertySource
into the SpringEnvironment
@ConfigurationProperties
should continue to work.One option might be to set
spring.config.name
to a list of the files you want to load:If you want something more specific you could perhaps listen for
ApplicationEnvironmentPreparedEvents
or write aEnvironmentPostProcessor
.The listener approach would look like this:
Alternatively, perhaps you could just put all your properties in the
application.properties
file and do away with the need to load additional files all together.