Search code examples
javaspringspring-boottomcatapplication.properties

Changing Tomcat properties dynamically in Spring Boot


Generally, I specify Tomcat properties in the application.properties file of my Spring Boot application. Is there any way to change some of those properties (which can be changed) dynamically, in the runtime? May be, by hitting an endpoint?

If not, is there any other way to make them dynamic from within the application code (and not the properties file)?

There are some libraries that can be configured both from the application.properties and dynamically as well (using endpoints). Does Tomcat provide any such mechanism?


Solution

  • Yes, there is. You can configure and hit endpoints to reconfigure:

    https://cloud.spring.io/spring-cloud-config/reference/html/