Java Reference
In-Depth Information
<beans:bean
class="org.springframework.beans.factory.config.Property
➥
PlaceholderConfigurer"
p:location="batch.properties"
p:ignoreUnresolvablePlaceholders="true" />
<beans:bean
id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close"
p:driverClassName="${dataSource.driverClassName}"
p:username="${dataSource.username}"
p:password="${dataSource.password}"
p:url="${dataSource.url}" />
<beans:bean
id="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager"
p:dataSource-ref="dataSource" />
<beans:bean
id="jobLauncher"
class="org.springframework.batch.core.launch.support.SimpleJobLauncher"
p:jobRepository-ref="jobRepository" />
<beans:bean
class="org.springframework.batch.core.configuration.support.
➥
JobRegistryBeanPostProcessor"
p:jobRegistry-ref="jobRegistry" />
<beans:bean
id="jobRepository"
class="org.springframework.batch.core.repository.support.
➥
JobRepositoryFactoryBean"
p:dataSource-ref="dataSource"
p:transactionManager-ref="transactionManager" />
<beans:bean
id="jobRegistry"
class="org.springframework.batch.core.configuration.support.
➥
MapJobRegistry" />
</beans:beans>
Because the implementation uses a database to persist the metadata, take care to configure a
DataSource
as well as a
TransactionManager
. In this example, you're using a
PropertyPlaceholderConfigurer
to load the contents of a properties file (
batch.properties
) whose values you use to configure the data
source. You need to place values for your particular database in this file. This example uses Spring's
property schema (
"p"
) to abbreviate the tedious configuration. In subsequent examples, this file will be
referenced as
batch.xml
.
Search WWH ::
Custom Search