Java Reference
In-Depth Information
<bean id="jobLauncher"
<property name="jobRepository" ref="jobRepository" />
<bean id="jobRepository"
p:dataSource-/ref="dataSource" p:transactionManager-ref="transactionManager" />
<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 id="transactionManager"
<property name="dataSource" ref="dataSource" />
<bean id="placeholderProperties"
<property name="location" value="" />
<property name="systemPropertiesModeName"
<property name="ignoreUnresolvablePlaceholders" value="true" />
<property name="order" value="1" />
A quick walkthrough of this file shows that it looks like a normal applicationContext.xml file for
Spring because … it's a normal applicationContext.xml file from Spring. You begin with the standard
XML namespace declarations for the file. From there, you define six beans:
jobExplorer : This bean is used by Spring Batch to access the JobRepository in a
read-only mode. The JobExplorer's only dependency is a datasource.
JobLauncher : In order to run a job with Spring Batch, a JobLauncher is required.
Here you keep things simple and use the SimpleJobLauncher that is provided by
the framework. Although you could administer this job in a number of ways, in
most enterprises jobs are administered by an external scheduler, so there is no
reason to get fancy here. The JobLauncher has the JobRepository as its only
JobRepository : The JobRepository provides CRUD operations for Spring Batch to
persist state and other metadata about each job run. Because you use a persistent
JobRepository, it requires a datasource and a transaction manager for its
Search WWH ::

Custom Search