add jdbc-operations attribute to <batch:job-repository>
This commit is contained in:
@@ -65,6 +65,8 @@ public class JobRepositoryParser extends AbstractSingleBeanDefinitionParser {
|
||||
CoreNamespaceUtils.autoregisterBeansForNamespace(parserContext, element);
|
||||
|
||||
String dataSource = element.getAttribute("data-source");
|
||||
|
||||
String jdbcOperations = element.getAttribute("jdbc-operations");
|
||||
|
||||
String transactionManager = element.getAttribute("transaction-manager");
|
||||
|
||||
@@ -82,6 +84,9 @@ public class JobRepositoryParser extends AbstractSingleBeanDefinitionParser {
|
||||
builder.addPropertyValue("dataSource", ds);
|
||||
RuntimeBeanReference tx = new RuntimeBeanReference(transactionManager);
|
||||
builder.addPropertyValue("transactionManager", tx);
|
||||
if (StringUtils.hasText(jdbcOperations)) {
|
||||
builder.addPropertyReference("jdbcOperations", jdbcOperations);
|
||||
}
|
||||
if (StringUtils.hasText(isolationLevelForCreate)) {
|
||||
builder.addPropertyValue("isolationLevelForCreate", DefaultTransactionDefinition.PREFIX_ISOLATION
|
||||
+ isolationLevelForCreate);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
http\://www.springframework.org/schema/batch/spring-batch.xsd=/org/springframework/batch/core/configuration/xml/spring-batch-2.2.xsd
|
||||
http\://www.springframework.org/schema/batch/spring-batch-3.0.xsd=/org/springframework/batch/core/configuration/xml/spring-batch-3.0.xsd
|
||||
http\://www.springframework.org/schema/batch/spring-batch-2.2.xsd=/org/springframework/batch/core/configuration/xml/spring-batch-2.2.xsd
|
||||
http\://www.springframework.org/schema/batch/spring-batch-2.1.xsd=/org/springframework/batch/core/configuration/xml/spring-batch-2.1.xsd
|
||||
http\://www.springframework.org/schema/batch/spring-batch-2.0.xsd=/org/springframework/batch/core/configuration/xml/spring-batch-2.0.xsd
|
||||
|
||||
@@ -184,7 +184,8 @@
|
||||
<xsd:attribute name="data-source" type="xsd:string" default="dataSource">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation source="java:javax.sql.DataSource"><![CDATA[
|
||||
ref" is not required, and only needs to be specified explicitly
|
||||
The bean name of the DataSource that is to be used. This attribute
|
||||
is not required, and only needs to be specified explicitly
|
||||
if the bean name of the desired DataSource is not 'dataSource'.
|
||||
]]></xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
@@ -194,6 +195,20 @@ ref" is not required, and only needs to be specified explicitly
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="jdbc-operations" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation source="java:org.springframework.jdbc.core.JdbcOperations"><![CDATA[
|
||||
The bean name of the JdbcOperations that is to be used. This attribute
|
||||
is not required, if it is not set a org.springframework.jdbc.core.JdbcTemplate will be
|
||||
created for the configured data-source.
|
||||
]]></xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation kind="ref">
|
||||
<tool:expected-type type="org.springframework.jdbc.core.JdbcOperations" />
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="transaction-manager" type="xsd:string" default="transactionManager">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation source="java:org.springframework.transaction.PlatformTransactionManager"><![CDATA[
|
||||
|
||||
@@ -1,19 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans:beans xmlns="http://www.springframework.org/schema/batch" xmlns:beans="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-2.2.xsd
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-3.0.xsd
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">
|
||||
|
||||
<beans:bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource" lazy-init="true">
|
||||
<beans:property name="driverClassName" value="org.hsqldb.jdbcDriver" />
|
||||
<beans:property name="url" value="jdbc:hsqldb:mem:testdb;sql.enforce_strict_size=true" />
|
||||
</beans:bean>
|
||||
<beans:bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
|
||||
<beans:property name="dataSource" ref="dataSource" />
|
||||
</beans:bean>
|
||||
<beans:bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
|
||||
<beans:property name="dataSource" ref="dataSource"/>
|
||||
</beans:bean>
|
||||
<beans:bean id="lobHandler" class="org.springframework.jdbc.support.lob.DefaultLobHandler"/>
|
||||
<beans:bean id="serializer" class="org.springframework.batch.core.repository.dao.DefaultExecutionContextSerializer"/>
|
||||
|
||||
<job-repository id="jobRepo1" data-source="dataSource" transaction-manager="transactionManager" lob-handler="lobHandler" max-varchar-length="100" serializer="serializer"/>
|
||||
<job-repository id="jobRepo1" data-source="dataSource" jdbc-operations="jdbcTemplate" transaction-manager="transactionManager" lob-handler="lobHandler" max-varchar-length="100" serializer="serializer"/>
|
||||
|
||||
</beans:beans>
|
||||
Reference in New Issue
Block a user