user2585494
user2585494

Reputation: 611

Properties change with out a server restart

I have externalized all my application needed property files from webapps in tomcat. Now i can simply change a property file value without a need of rebuilding the war file and deploy it again. However each change to property file is associated with server recyling.

Is there a way how the recycling can be avoided for a property file change. I am using spring to read the property files for few webapps and java property traditional way for few webapps.

Please suggest how to acheive

Upvotes: 6

Views: 10711

Answers (2)

PanHrabia
PanHrabia

Reputation: 174

You may also give cfg4j a try. It supports reloading configuration from local files as well as remote services (git repository, Consul, etc.).

Upvotes: 1

iamiddy
iamiddy

Reputation: 3073

You may want to consider spring-cloud-config-server or spring-cloud-consul all of these options supports distributed properties management as well as value changes refresh without a need to recycle app servers.

And you can use @RefreshScope for Spring @Beans that want to be reinitialized when configuration changes, they also provide the following Management endpoints out of the box and many more as explained on the project git page

  • /refresh for refreshing the @RefreshScope beans
  • /restart for restarting the Spring context (disabled by default)

This is supported by either option (spring-cloud-config-server or spring-cloud-consul)

Upvotes: 3

Related Questions