1

My requirement is to update the configurations of my application automatically when a change is made to a properties file.
For maintaining the properties, I am using PropertiesConfiguration from Apache Commons Configuration project.(Using commons-configuration-1.6.jar).
Using the FileChangedReloadingStrategy works well for a change made to a single properties file and is picked up by my application.

    PropertiesConfiguration config = new PropertiesConfiguration();
    config.load(new File("../test1.properties"));
    config.load(new File("../test2.properties"));
    config.setReloadingStrategy(new FileChangedReloadingStrategy());

But I am using multiple properties files using their load method and when any one of the properties file is updated I need to be able to detect the changes and automatically update the configuration in my project.
Is there a way to do this update using the FileChangedReloadingStrategy?
Or is there any other way you would suggest that I can make use of?

Vivek Nandavanam
  • 1,805
  • 2
  • 13
  • 13

1 Answers1

2

You can use a CompositeConfiguration to join two separate FileConfigurations, each with its own FileChangedReloadingStrategy.

Keith Randall
  • 22,985
  • 2
  • 35
  • 54