I have developed a webapplication which is having jsp and java code. Right now I have placed all the key-value into a env/lifecycle specific properties file (like conf-dev.properties,conf-stg.properties,conf-prod.properties).
I want to externalize these properties file so that it can be placed outside of war(without effecting the war). right now war file is tightly coupled with properties file. if i have to modify any thing i have to build and make war and deploy.
I have very limited access on deployment server machine (only have access for one folder where i can put my configuration files) & deployment process is handled by CI(jenkin & automated script).
I explored on internet and came to know that we can achieve this using spring, would like to know what is the best way to achieve this?
As you are using Spring I suppose you already use PropertyPlaceholderConfigurer
. If not you should ;)
The location of a property file can be anything that can be resolved as spring Resource
. This includes classpath, servletcontext and also file references as URIs (file:///... For absolute paths)
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="${config.file.location}" />
</bean>