Note that there are some explanatory texts on larger screens.

plurals
  1. POConfiguring Spring based servlet with sysadmin defined properties
    text
    copied!<p>I have a web application that's based on Spring and the application contexts, applicationContext.xml and myServlet-servlet.xml contain settings that should be configurable by the sysadmin in deployment.</p> <p>What's the best way to enable changing of settings like [database server details, remote webservice endpoints, etc] without requiring editing of the WAR contents?</p> <p>Spring provides the <a href="http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/beans/factory/config/PropertyPlaceholderConfigurer.html" rel="nofollow noreferrer">PropertyPlaceholderConfigurer</a> which can be used in the beans configurations, but I think that's going to require an absolute path to the properties file, which I'd like to avoid, if for no other reason than to allow multiple instances of the same servlet to run on the same machine.</p> <p>There's also maybe the option to use JNDI configured resources, though there doesn't appear to be a <a href="http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/beans/factory/config/BeanFactoryPostProcessor.html" rel="nofollow noreferrer">BeanFactoryPostProcessor</a> implementation out-the-box doing this so it might not be a good way to approach it.</p> <p>What's the standard best-practice, if there is one, to deal with this sort of requirement?</p> <p>Related SO entries:</p> <p><a href="https://stackoverflow.com/questions/372686/how-can-i-specify-system-properties-in-tomcat-configuration-on-startup">How can I specify system properties in Tomcat configuration on startup?</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload