Answer the question
In order to leave comments, you need to log in
How to reread settings after changing properties file?
Good afternoon.
Using Spring Boot
There is a @ConfigurationProperties class - with settings from the properties file.
Can I somehow make it so that when this properties file is changed, the settings in this class are updated automatically, without reloading the application?
I know that there is Spring Cloud Config, but I would like something simpler, I just changed the file, the settings were updated.
Answer the question
In order to leave comments, you need to log in
mitaichik
@Vope
example from
collection of small and focused Spring tutorials
https://github.com/eugenp/tutorials/tree/master/sp...
works great
with minimal changes if there is no desire or ability to move from spring 4.x to 5 .x
we take the code, we screw it into our project, we
assemble it, we
plant it in the docker or we launch it locally, specifying the path to application.properties
docker run -v ${HOME}/Desktop/:/var/properties -p 8086:8080 basic-example
curl http://localhost:8085/basic
Hello some value
sed -i 's|some value|some other value|' ~/Desktop/application.properties
curl http://localhost:8085/basic
Hello some other value
There is Spring Boot DevTools, but I'm not sure that it will work with the config, rather no than yes :)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question