简体   繁体   中英

How to Modify application.properties file dynamically in spring application?

Currently we have spring applications which are deployed on to Tomcat Servers.We are trying to update application.properties dynamically on the fly, without restarting our server/service. What are our options? Do we need right any polling service which listens to event changes and update props file?

You can use the Spring Config project. As per the microservice architecture, you can define a different spring profile based on the environment and you will get the capability to reload application properties on the fly without restarting the application using Spring cloud bus events. The same setup can be useful in monolithic architecture as well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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