I am trying to figure out how I can dynamically update / reload external configuration in a Spring Boot application without restarting the entire application.
Most of the recommendations include reloading the ApplicationContext after changing the external configuration, but this is equivalent to restarting the entire application, so this is actually not so useful.
After reading the SpringBoot reference documentation, I found Chapter 23.7 Secure Access Configuration Properties .
If I understand correctly, this allows you to define simple POJO classes that will contain your application configuration values (external) as attributes.
In theory, at least this scheme can be used to bind beans only once to the desired POJO configuration, and after changing the configuration, simply update the values in the POJO. Components can easily pick up changes the next time they access POJO recipients ...
However, I have not yet been able to figure out how to enable this type of behavior. Is there an obvious way to dynamically update components annotated with @ConfigurationProperties
when changing the appropriate configuration?
source
share