Reputation: 1
I have a config.properties file to store Credentials and IP address for my application as Key Value pairs. However writes to this properties file reloads the application context in tomcat. I am writing to properties file as below
URL propUrl=this.getClass().getClassLoader().getResource(PROPERTIES_FILE);
prop.store(new FileOutputStream(propUrl.getPath()), null);
So,
1.) Is there a way to detect a tomcat context reload in Java.
or
2.) Is there a way to prevent context reload and read the config.properties file
Upvotes: 0
Views: 2832
Reputation: 140011
To disable automatic reloading of the context (which is the Tomcat term for the webapp), set the reloadable
attribute of the <Context>
element in the server config to false
. See here for reference, search for "reloadable".
Upvotes: 0
Reputation: 24801
reloadable=false
to prevent reloading of the context.Upvotes: 1