BATCH-2234: Updated documentation to outline setup requirements as well as adding batch-*.properties files for the other database types
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
http://www.springframework.org/schema/jdbc/spring-jdbc.xsd">
|
||||
|
||||
<batch:job-repository data-source="dataSource" id="jobRepository"
|
||||
transaction-manager="transactionManager" table-prefix="BATCH_"/>
|
||||
transaction-manager="transactionManager" table-prefix="${batch.table.prefix}"/>
|
||||
|
||||
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
|
||||
<property name="jobRepository" ref="jobRepository"/>
|
||||
@@ -28,8 +28,7 @@
|
||||
<property name="dataSource" ref="dataSource"/>
|
||||
</bean>
|
||||
|
||||
<bean id="dataSource"
|
||||
class="org.apache.commons.dbcp.BasicDataSource">
|
||||
<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}" />
|
||||
|
||||
18
spring-batch-core/src/main/resources/batch-derby.properties
Normal file
18
spring-batch-core/src/main/resources/batch-derby.properties
Normal file
@@ -0,0 +1,18 @@
|
||||
# Placeholders batch.*
|
||||
# for Derby:
|
||||
batch.jdbc.driver=org.apache.derby.jdbc.EmbeddedDriver
|
||||
batch.jdbc.url=jdbc:derby:derby-home/test;create=true
|
||||
batch.jdbc.user=app
|
||||
batch.jdbc.password=
|
||||
batch.database.incrementer.class=org.springframework.jdbc.support.incrementer.DerbyMaxValueIncrementer
|
||||
batch.schema.script=classpath:/org/springframework/batch/core/schema-derby.sql
|
||||
batch.drop.script=classpath:/org/springframework/batch/core/schema-drop-derby.sql
|
||||
batch.business.schema.script=
|
||||
batch.jdbc.testWhileIdle=true
|
||||
batch.jdbc.validationQuery=
|
||||
|
||||
|
||||
# Non-platform dependent settings that you might like to change
|
||||
batch.data.source.init=true
|
||||
batch.table.prefix=BATCH_
|
||||
|
||||
18
spring-batch-core/src/main/resources/batch-h2.properties
Normal file
18
spring-batch-core/src/main/resources/batch-h2.properties
Normal file
@@ -0,0 +1,18 @@
|
||||
# Placeholders batch.*
|
||||
# for H2:
|
||||
batch.jdbc.driver=org.h2.Driver
|
||||
batch.jdbc.url=jdbc:h2:file:build/data/h2
|
||||
batch.jdbc.user=sa
|
||||
batch.jdbc.password=
|
||||
batch.database.incrementer.class=org.springframework.jdbc.support.incrementer.H2SequenceMaxValueIncrementer
|
||||
batch.schema.script=classpath:/org/springframework/batch/core/schema-h2.sql
|
||||
batch.drop.script=classpath:/org/springframework/batch/core/schema-drop-h2.sql
|
||||
batch.business.schema.script=
|
||||
batch.jdbc.testWhileIdle=true
|
||||
batch.jdbc.validationQuery=
|
||||
|
||||
|
||||
# Non-platform dependent settings that you might like to change
|
||||
batch.data.source.init=true
|
||||
batch.table.prefix=BATCH_
|
||||
|
||||
@@ -17,3 +17,5 @@ batch.jdbc.validationQuery=
|
||||
|
||||
# Non-platform dependent settings that you might like to change
|
||||
batch.data.source.init=true
|
||||
batch.table.prefix=BATCH_
|
||||
|
||||
|
||||
18
spring-batch-core/src/main/resources/batch-mysql.properties
Normal file
18
spring-batch-core/src/main/resources/batch-mysql.properties
Normal file
@@ -0,0 +1,18 @@
|
||||
# Placeholders batch.*
|
||||
# for MySQL:
|
||||
batch.jdbc.driver=com.mysql.jdbc.Driver
|
||||
batch.jdbc.url=jdbc:mysql://localhost/test
|
||||
batch.jdbc.user=test
|
||||
batch.jdbc.password=test
|
||||
batch.database.incrementer.class=org.springframework.jdbc.support.incrementer.MySQLMaxValueIncrementer
|
||||
batch.schema.script=classpath:/org/springframework/batch/core/schema-mysql.sql
|
||||
batch.drop.script=classpath:/org/springframework/batch/core/schema-drop-mysql.sql
|
||||
batch.business.schema.script=
|
||||
batch.jdbc.testWhileIdle=true
|
||||
batch.jdbc.validationQuery=
|
||||
|
||||
|
||||
# Non-platform dependent settings that you might like to change
|
||||
batch.data.source.init=true
|
||||
batch.table.prefix=BATCH_
|
||||
|
||||
18
spring-batch-core/src/main/resources/batch-oracle.properties
Normal file
18
spring-batch-core/src/main/resources/batch-oracle.properties
Normal file
@@ -0,0 +1,18 @@
|
||||
# Placeholders batch.*
|
||||
# for Oracle:
|
||||
batch.jdbc.driver=oracle.jdbc.OracleDriver
|
||||
batch.jdbc.url=jdbc:oracle:thin:@oracle:1521:xe
|
||||
batch.jdbc.user=spring
|
||||
batch.jdbc.password=spring
|
||||
batch.database.incrementer.class=org.springframework.jdbc.support.incrementer.OracleSequenceMaxValueIncrementer
|
||||
batch.schema.script=classpath:/org/springframework/batch/core/schema-oracle10g.sql
|
||||
batch.drop.script=classpath:/org/springframework/batch/core/schema-drop-oracle10g.sql
|
||||
batch.business.schema.script=
|
||||
batch.jdbc.testWhileIdle=false
|
||||
batch.jdbc.validationQuery=
|
||||
|
||||
|
||||
# Non-platform dependent settings that you might like to change
|
||||
batch.data.source.init=true
|
||||
batch.table.prefix=BATCH_
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
# Placeholders batch.*
|
||||
# for Postgres:
|
||||
batch.jdbc.driver=org.postgresql.Driver
|
||||
batch.jdbc.url=jdbc:postgresql://localhost/samples
|
||||
batch.jdbc.user=postgres
|
||||
batch.jdbc.password=dba
|
||||
batch.database.incrementer.class=org.springframework.jdbc.support.incrementer.PostgreSQLSequenceMaxValueIncrementer
|
||||
batch.schema.script=classpath:/org/springframework/batch/core/schema-postgresql.sql
|
||||
batch.drop.script=classpath:/org/springframework/batch/core/schema-drop-postgresql.sql
|
||||
batch.business.schema.script=
|
||||
batch.jdbc.testWhileIdle=false
|
||||
batch.jdbc.validationQuery=
|
||||
|
||||
|
||||
# Non-platform dependent settings that you might like to change
|
||||
batch.data.source.init=true
|
||||
batch.table.prefix=BATCH_
|
||||
|
||||
18
spring-batch-core/src/main/resources/batch-sqlf.properties
Normal file
18
spring-batch-core/src/main/resources/batch-sqlf.properties
Normal file
@@ -0,0 +1,18 @@
|
||||
# Placeholders batch.*
|
||||
# for SQLFire:
|
||||
batch.jdbc.driver=com.vmware.sqlfire.jdbc.ClientDriver
|
||||
batch.jdbc.url=jdbc:sqlfire://localhost:1257/;update=true
|
||||
batch.jdbc.user=SAMPLES
|
||||
batch.jdbc.password=SAMPLES
|
||||
batch.database.incrementer.class=org.springframework.jdbc.support.incrementer.DerbyMaxValueIncrementer
|
||||
batch.schema.script=classpath:/org/springframework/batch/core/schema-sqlf.sql
|
||||
batch.drop.script=classpath:/org/springframework/batch/core/schema-drop-sqlf.sql
|
||||
batch.business.schema.script=
|
||||
batch.jdbc.testWhileIdle=false
|
||||
batch.jdbc.validationQuery=
|
||||
|
||||
|
||||
# Non-platform dependent settings that you might like to change
|
||||
batch.data.source.init=true
|
||||
batch.table.prefix=BATCH_
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
# Placeholders batch.*
|
||||
# for MS SQLServer:
|
||||
batch.jdbc.driver=net.sourceforge.jtds.jdbc.Driver
|
||||
batch.jdbc.url=jdbc:jtds:sqlserver://localhost:1433;instance=SQLEXPRESS
|
||||
batch.jdbc.user=sa
|
||||
batch.jdbc.password=sa
|
||||
batch.database.incrementer.class=org.springframework.jdbc.support.incrementer.SqlServerMaxValueIncrementer
|
||||
batch.schema.script=classpath*:/org/springframework/batch/core/schema-sqlserver.sql
|
||||
batch.drop.script=classpath*:/org/springframework/batch/core/schema-drop-sqlserver.sql
|
||||
batch.business.schema.script=
|
||||
batch.jdbc.testWhileIdle=false
|
||||
batch.jdbc.validationQuery=
|
||||
|
||||
|
||||
# Non-platform dependent settings that you might like to change
|
||||
batch.data.source.init=true
|
||||
batch.table.prefix=BATCH_
|
||||
|
||||
18
spring-batch-core/src/main/resources/batch-sybase.properties
Normal file
18
spring-batch-core/src/main/resources/batch-sybase.properties
Normal file
@@ -0,0 +1,18 @@
|
||||
# Placeholders batch.*
|
||||
# for Sybase:
|
||||
batch.jdbc.driver=net.sourceforge.jtds.jdbc.Driver
|
||||
batch.jdbc.url=jdbc:jtds:sybase://dbhost:5000;databaseName=test
|
||||
batch.jdbc.user=spring
|
||||
batch.jdbc.password=spring
|
||||
batch.database.incrementer.class=org.springframework.jdbc.support.incrementer.SybaseMaxValueIncrementer
|
||||
batch.schema.script=classpath*:/org/springframework/batch/core/schema-sybase.sql
|
||||
batch.drop.script=classpath*:/org/springframework/batch/core/schema-drop-sybase.sql
|
||||
batch.business.schema.script=
|
||||
batch.jdbc.testWhileIdle=true
|
||||
batch.jdbc.validationQuery=
|
||||
|
||||
|
||||
# Non-platform dependent settings that you might like to change
|
||||
batch.data.source.init=true
|
||||
batch.table.prefix=BATCH_
|
||||
|
||||
@@ -16,3 +16,4 @@ batch.grid.size=2
|
||||
batch.jdbc.pool.size=6
|
||||
batch.verify.cursor.position=false
|
||||
batch.isolationlevel=ISOLATION_SERIALIZABLE
|
||||
batch.table.prefix=BATCH_
|
||||
|
||||
@@ -16,3 +16,4 @@ batch.grid.size=2
|
||||
batch.jdbc.pool.size=6
|
||||
batch.verify.cursor.position=true
|
||||
batch.isolationlevel=ISOLATION_SERIALIZABLE
|
||||
batch.table.prefix=BATCH_
|
||||
|
||||
@@ -20,3 +20,4 @@ batch.grid.size=6
|
||||
batch.verify.cursor.position=true
|
||||
batch.isolationlevel=ISOLATION_SERIALIZABLE
|
||||
batch.data.source.init=true
|
||||
batch.table.prefix=BATCH_
|
||||
|
||||
@@ -16,4 +16,5 @@ batch.jdbc.pool.size=6
|
||||
batch.grid.size=50
|
||||
batch.verify.cursor.position=true
|
||||
batch.isolationlevel=ISOLATION_SERIALIZABLE
|
||||
batch.table.prefix=BATCH_
|
||||
|
||||
|
||||
@@ -16,4 +16,5 @@ batch.grid.size=2
|
||||
batch.jdbc.pool.size=6
|
||||
batch.verify.cursor.position=true
|
||||
batch.isolationlevel=ISOLATION_SERIALIZABLE
|
||||
batch.table.prefix=BATCH_
|
||||
|
||||
|
||||
@@ -17,4 +17,5 @@ batch.lob.handler.class=org.springframework.jdbc.support.lob.DefaultLobHandler
|
||||
batch.grid.size=2
|
||||
batch.jdbc.pool.size=6
|
||||
batch.verify.cursor.position=false
|
||||
batch.isolationlevel=ISOLATION_SERIALIZABLE
|
||||
batch.isolationlevel=ISOLATION_SERIALIZABLE
|
||||
batch.table.prefix=BATCH_
|
||||
|
||||
@@ -19,4 +19,5 @@ batch.jdbc.pool.size=6
|
||||
batch.verify.cursor.position=false
|
||||
#add this for your jobRepository bean p:isolationLevelForCreate = "${batch.isolationlevel}"
|
||||
#see simple-job-launcher-context.xml for example
|
||||
batch.isolationlevel=ISOLATION_READ_COMMITTED
|
||||
batch.isolationlevel=ISOLATION_READ_COMMITTED
|
||||
batch.table.prefix=BATCH_
|
||||
|
||||
@@ -16,4 +16,5 @@ batch.grid.size=2
|
||||
batch.jdbc.pool.size=6
|
||||
batch.verify.cursor.position=true
|
||||
batch.isolationlevel=ISOLATION_SERIALIZABLE
|
||||
batch.table.prefix=BATCH_
|
||||
|
||||
|
||||
@@ -16,5 +16,6 @@ batch.jdbc.pool.size=6
|
||||
batch.grid.size=6
|
||||
batch.verify.cursor.position=true
|
||||
batch.isolationlevel=ISOLATION_SERIALIZABLE
|
||||
batch.table.prefix=BATCH_
|
||||
|
||||
|
||||
|
||||
@@ -26,6 +26,162 @@
|
||||
important to note that batch artifacts that have been developed against the JSR-352 interfaces will not work
|
||||
within a traditional Spring Batch job.</para>
|
||||
</section>
|
||||
|
||||
<section id="jsrSetup">
|
||||
<title>Setup</title>
|
||||
|
||||
<para>JSR-352 requires a very simple path to executing a batch job. The following code is all that is needed to
|
||||
execute your first batch job:
|
||||
</para>
|
||||
|
||||
<programlisting language="java">JobOperator operator = BatchRuntime.getJobOperator();
|
||||
jobOperator.start("myJob", new Properties());</programlisting>
|
||||
|
||||
<para>While that is convenient for developers, the devil is in the details. Spring Batch bootstraps a bit of
|
||||
infrastructure behind the scenes that a developer may want to override. The following is bootstrapped the
|
||||
first time <code>BatchRuntime.getJobOperator()</code> is called:
|
||||
<informaltable frame="all" rowsep="1" colsep="1">
|
||||
<tgroup cols="3">
|
||||
<colspec align="left"/>
|
||||
<colspec align="left"/>
|
||||
<colspec align="left"/>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>
|
||||
<emphasis role="bold">Bean Name</emphasis>
|
||||
</entry>
|
||||
<entry>
|
||||
<emphasis role="bold">Default Configuration</emphasis>
|
||||
</entry>
|
||||
<entry>
|
||||
<emphasis role="bold">Notes</emphasis>
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
dataSource
|
||||
</entry>
|
||||
<entry>
|
||||
Apache DBCP BasicDataSource with configured values.
|
||||
</entry>
|
||||
<entry>
|
||||
By default, HSQLDB is bootstrapped.
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<code>transactionManager</code>
|
||||
</entry>
|
||||
<entry>
|
||||
<code>org.springframework.jdbc.datasource.DataSourceTransactionManager</code>
|
||||
</entry>
|
||||
<entry>
|
||||
References the dataSource bean defined above.
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
A Datasource initializer
|
||||
</entry>
|
||||
<entry>
|
||||
</entry>
|
||||
<entry>
|
||||
This is configured to execute the scripts configured via the
|
||||
<code>batch.drop.script</code> and <code>batch.schema.script</code> properties. By
|
||||
default, the schema scripts for HSQLDB are executed. This behavior can be disabled via
|
||||
<code>batch.data.source.init</code> property.
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
jobRepository
|
||||
</entry>
|
||||
<entry>
|
||||
A JDBC based <code>SimpleJobRepository</code>.
|
||||
</entry>
|
||||
<entry>
|
||||
This <code>JobRepository</code> uses the previously mentioned data source and transaction
|
||||
manager. The schema's table prefix is configurable (defaults to BATCH_) via the
|
||||
<code>batch.table.prefix</code> property.
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
jobLauncher
|
||||
</entry>
|
||||
<entry>
|
||||
<code>org.springframework.batch.core.launch.support.SimpleJobLauncher</code>
|
||||
</entry>
|
||||
<entry>
|
||||
Used to launch jobs.
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
batchJobOperator
|
||||
</entry>
|
||||
<entry>
|
||||
<code>org.springframework.batch.core.launch.support.SimpleJobOperator</code>
|
||||
</entry>
|
||||
<entry>
|
||||
The <code>JsrJobOperator</code> wraps this to provide most of it's functionality.
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
jobExplorer
|
||||
</entry>
|
||||
<entry>
|
||||
<code>org.springframework.batch.core.explore.support.JobExplorerFactoryBean</code>
|
||||
</entry>
|
||||
<entry>
|
||||
Used to address lookup functionality provided by the <code>JsrJobOperator</code>.
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
jobParametersConverter
|
||||
</entry>
|
||||
<entry>
|
||||
<code>org.springframework.batch.core.jsr.JsrJobParametersConverter</code>
|
||||
</entry>
|
||||
<entry>
|
||||
JSR-352 specific implementation of the <code>JobParametersConverter</code>.
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
jobRegistry
|
||||
</entry>
|
||||
<entry>
|
||||
<code>org.springframework.batch.core.configuration.support.MapJobRegistry</code>
|
||||
</entry>
|
||||
<entry>
|
||||
Used by the <code>SimpleJobOperator</code>.
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
placeholderProperties
|
||||
</entry>
|
||||
<entry>
|
||||
<code>org.springframework.beans.factory.config.PropertyPlaceholderConfigure</code>
|
||||
</entry>
|
||||
<entry>
|
||||
Loads the properties file <code>batch-${ENVIRONMENT:hsql}.properties</code> to configure
|
||||
the properties mentioned above. ENVIRONMENT is a System property (defaults to hsql)
|
||||
that can be used to specify any of the supported databases Spring Batch currently
|
||||
supports.
|
||||
</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
</para>
|
||||
<note><para>None of the above beans are optional for executing JSR-352 based jobs. All may be overriden to
|
||||
provide customized functionality as needed.
|
||||
</para></note>
|
||||
</section>
|
||||
|
||||
<section id="dependencyInjection">
|
||||
<title>Dependency Injection</title>
|
||||
|
||||
Reference in New Issue
Block a user