For Spring MVC project, I want to reduce errors and the amount of time when switching servers, paths, and etc in the servlet context.
Is there a way to store variables in the servlet context (i.e. servlet-context.xml
)?
Example
VARIABLE is used to to switch the server url, user, and password in myDataSource
VARIABLE = "GOOGLE" // Server type: GOOGLE, YAHOO, BING. This will switch the server url, user, and password in myDataSource
<beans:bean id="myDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<beans:property name="driverClassName" value="${jdbc.sqlserver.driver}" />
<beans:property name="url" value="${jdbc.**VARIABLE**.url}" />
<beans:property name="username" value="${jdbc.**VARIABLE**.user}" />
<beans:property name="password" value="${jdbc.**VARIABLE**.pw}" />
</beans:bean>