If you're using Spring 3.0 or later, you can use the property inside the SpEL expression like this:
<property name="validationQueryTimeout" value="#{${jdbc.timeout}/1000}" />
Question
Example use-case: properties file passes in a numeric value in millis, and you want to use it in seconds.
Your .properties file:
jdbc.timeout= 2000
Your applicationContext.xml currently
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url"value="jdbc:mysql://myserver/mydb" />
<property name="username" value="user" />
<property name="password" value="changeme" />
<property name="validationQuery" value="SELECT 1;"/>
<property name="validationQueryTimeout" value="${jdbc.timeout}" />
</bean>
You want the validationQueryTimeout value to be in seconds, how do you convert it?
Solution
If you're using Spring 3.0 or later, you can use the property inside the SpEL expression like this:
<property name="validationQueryTimeout" value="#{${jdbc.timeout}/1000}" />