RESOLVED - issue BATCH-980: Add SystemPropertyInitializer
This commit is contained in:
@@ -6,39 +6,28 @@
|
||||
|
||||
<!-- Initialise the database before every test case: -->
|
||||
<import resource="data-source-context-init.xml" />
|
||||
|
||||
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
|
||||
<property name="driverClassName" value="${batch.jdbc.driver}" />
|
||||
<property name="url" value="${batch.jdbc.url}" />
|
||||
<property name="username" value="${batch.jdbc.user}" />
|
||||
<property name="password" value="${batch.jdbc.password}" />
|
||||
</bean>
|
||||
|
||||
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager" lazy-init="true">
|
||||
<property name="dataSource" ref="dataSource" />
|
||||
</bean>
|
||||
|
||||
<!-- Set up or detect a System property called "environment" used to construct a properties file on the classpath. The default is "hsql". -->
|
||||
<bean id="environment" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
|
||||
<property name="targetClass" value="java.lang.System" />
|
||||
<property name="targetMethod" value="setProperty" />
|
||||
<property name="arguments">
|
||||
<list>
|
||||
<value>environment</value>
|
||||
<bean class="java.lang.System" factory-method="getProperty">
|
||||
<constructor-arg>
|
||||
<value>environment</value>
|
||||
</constructor-arg>
|
||||
<!-- The default value of the environment property -->
|
||||
<constructor-arg>
|
||||
<value>hsql</value>
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
</list>
|
||||
</property>
|
||||
<bean id="environment"
|
||||
class="org.springframework.batch.support.SystemPropertyInitializer">
|
||||
<property name="defaultValue" value="hsql"/>
|
||||
</bean>
|
||||
|
||||
<!-- Use this to set additional properties on beans at run time -->
|
||||
<bean id="overrideProperties" class="org.springframework.beans.factory.config.PropertyOverrideConfigurer"
|
||||
depends-on="environment">
|
||||
<property name="location" value="classpath:batch-${environment}.properties" />
|
||||
<property name="location" value="classpath:batch-${org.springframework.batch.support.SystemPropertyInitializer.ENVIRONMENT}.properties" />
|
||||
<!-- Allow system properties (-D) to override those from file -->
|
||||
<property name="localOverride" value="true" />
|
||||
<property name="properties">
|
||||
@@ -47,18 +36,22 @@
|
||||
<property name="ignoreInvalidKeys" value="true" />
|
||||
<property name="order" value="2" />
|
||||
</bean>
|
||||
|
||||
<bean id="placeholderProperties" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
|
||||
depends-on="environment">
|
||||
<property name="location" value="classpath:batch-${environment}.properties" />
|
||||
<property name="location" value="classpath:batch-${org.springframework.batch.support.SystemPropertyInitializer.ENVIRONMENT}.properties" />
|
||||
<property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
|
||||
<property name="ignoreUnresolvablePlaceholders" value="true" />
|
||||
<property name="order" value="1" />
|
||||
</bean>
|
||||
|
||||
<bean id="lobHandler" class="${batch.lob.handler.class}" />
|
||||
|
||||
<bean id="incrementerParent" class="${batch.database.incrementer.class}">
|
||||
<property name="dataSource" ref="dataSource" />
|
||||
<property name="incrementerName" value="ID" />
|
||||
</bean>
|
||||
|
||||
<!--import resource="alt-data-source-context.xml" /-->
|
||||
|
||||
</beans>
|
||||
Reference in New Issue
Block a user