java - Spring PropertyOverrideConfigurer not overriding PropertyPlaceholderConfigurer? -


i have spring 4.0 application in use property placeholder default bean values, , property-override overriding in these values in production environment. code looks this:

<context:property-placeholder location="classpath:config.properties" /> <context:property-override ignore-resource-not-found="true" ignore-unresolvable="true" location="file:${config.file}" /> 

so in production enviroment, pass parameter -dconfig.file=path/to/config/file.properties on tomcat startup override these values. example:

placeholder file:

datasource.url=jdbc:sqlserver://10.46.1.1;database=testdb datasource.user=mvdb datasource.password=xxx 

production file:

datasource.url=jdbc:sqlserver://10.77.10.14:1433;database=db datasource.user=mvdb datasource.password=xxx 

and bean defined as:

<bean id="datasource" class="com.mchange.v2.c3p0.combopooleddatasource" destroy-method="close">     <property name="driverclass" value="com.microsoft.sqlserver.jdbc.sqlserverdriver"/>     <property name="jdbcurl" value="${datasource.url}"/>     <property name="user" value="${datasource.user}"/>     <property name="password" value="${datasource.password}"/>         (more properties omitted) </bean> 

however, these values not getting overridden overriden file! can see in startup both files gets loaded:

[2015-07-14 10:37:57:057 cest]  info  support.propertysourcesplaceholderconfigurer: loading properties file class path resource [config.properties] [2015-07-14 10:37:58:058 cest]  info  config.propertyoverrideconfigurer: loading properties file url [file:c:/var/opt/config/config.properties] 

but still uses values placeholder classpath file , tries connect test database.

any ideas?


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -