This is my code for ApplicationContext.xml
<bean class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" id="dataSource">
<property name="driverClassName" value="${database.driverClassName}" />
<property name="url" value="${database.url}" />
<property name="username" value="${database.username}" />
<property name="password" value="${database.password}" />
<property name="testOnBorrow" value="true" />
<property name="testOnReturn" value="true" />
<property name="testWhileIdle" value="true" />
<property name="timeBetweenEvictionRunsMillis" value="1800000" />
<property name="numTestsPerEvictionRun" value="3" />
<property name="minEvictableIdleTimeMillis" value="1800000" />
</bean>
My properties are defined in a file named database.properties
What changes do i need to make in the parent pom.xml to convert the env variable at target runtime
Can you please help or give me a proper suggestion or a link that could get me the name of database properties at runtime.
For eg
database.driverName
should be updated to jdbcDriver
Since my project had to respective .properties
file, and my parent pom.xml was taking only .properties file. It was not able to fetch the other .properties file. The reason my variables were not getting updated at runtime. I maintained a common.properties
file and added the path in pom.xml
Now i get the desired result