RESOLVED - issue BATCH-980: Add SystemPropertyInitializer
This commit is contained in:
@@ -37,7 +37,6 @@
|
||||
<property name="jobExplorer">
|
||||
<bean class="org.springframework.batch.core.explore.support.JobExplorerFactoryBean">
|
||||
<property name="dataSource" ref="dataSource" />
|
||||
<property name="databaseType" value="${environment}" />
|
||||
</bean>
|
||||
</property>
|
||||
<property name="jobRepository" ref="jobRepository" />
|
||||
|
||||
@@ -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>
|
||||
@@ -18,10 +18,6 @@
|
||||
<property name="jobRegistry" ref="jobRegistry"/>
|
||||
</bean>
|
||||
|
||||
<!--
|
||||
use p:databaseType="${environment}" below if auto-detection does not
|
||||
work
|
||||
-->
|
||||
<bean id="jobRepository"
|
||||
class="org.springframework.batch.core.repository.support.JobRepositoryFactoryBean"
|
||||
p:dataSource-ref="dataSource" p:transactionManager-ref="transactionManager" />
|
||||
@@ -37,7 +33,7 @@
|
||||
|
||||
<bean id="jobExplorer"
|
||||
class="org.springframework.batch.core.explore.support.JobExplorerFactoryBean"
|
||||
p:databaseType="${environment}" p:dataSource-ref="dataSource" />
|
||||
p:dataSource-ref="dataSource" />
|
||||
|
||||
<bean id="jobRegistry"
|
||||
class="org.springframework.batch.core.configuration.support.MapJobRegistry" />
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
<property name="jobRepository" ref="jobRepository" />
|
||||
</bean>
|
||||
|
||||
<!-- use p:databaseType="${environment}" below if auto-detection does not work -->
|
||||
<bean id="jobRepository"
|
||||
class="org.springframework.batch.core.repository.support.JobRepositoryFactoryBean"
|
||||
p:dataSource-ref="dataSource" p:transactionManager-ref="transactionManager" />
|
||||
@@ -29,7 +28,7 @@
|
||||
p:jobRegistry-ref="jobRegistry" />
|
||||
|
||||
<bean id="jobExplorer" class="org.springframework.batch.core.explore.support.JobExplorerFactoryBean"
|
||||
p:databaseType="${environment}" p:dataSource-ref="dataSource" />
|
||||
p:dataSource-ref="dataSource" />
|
||||
|
||||
<bean id="jobRegistry" class="org.springframework.batch.core.configuration.support.ClassPathXmlJobRegistry" >
|
||||
<constructor-arg value="jobs/skipSampleJob.xml" />
|
||||
|
||||
Reference in New Issue
Block a user