-
Aug 30th, 2012, 08:48 AM
#1
Creating multiple jobs in same xml file
Is it possbile to create mutiple jobs in the same xml file like listed below
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:batch="http://www.springframework.org/schema/batch"
xmlns:batch1="http://www.springframework.org/schema/batch"
xsi:schemaLocation="
http://www.springframework.org/schema/batch http://www.springframework.org/schem...-batch-2.1.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<description>Example job to get you started. It provides a skeleton for a typical batch application.</description>
<batch:job id="job1">
<batch:step id="step1" >
<batch:tasklet transaction-manager="transactionManager" start-limit="100" >
<batch:chunk reader="reader" writer="writer" commit-interval="1" />
</batch:tasklet>
</batch:step>
</batch:job>
<batch1:job id="job2">
<batch1:step id="step2" >
<batch1:tasklet transaction-manager="transactionManager" start-limit="100" >
<batch1:chunk reader="reader" writer="writer" commit-interval="1" />
</batch1:tasklet>
</batch1:step>
</batch1:job>
</beans>
when i run this i get this error
Exception in thread "main" org.springframework.beans.factory.NoSuchBeanDefini tionException: No unique bean of type [org.springframework.batch.core.Job] is defined: expected single bean but found 2: job1,job2
at org.springframework.beans.factory.support.DefaultL istableBeanFactory.getBean(DefaultListableBeanFact ory.java:271)
at org.springframework.context.support.AbstractApplic ationContext.getBean(AbstractApplicationContext.ja va:1083)
at com.cosi.test.SampleStart.main(SampleStart.java:29 )
please suggest at the earliest to get it done......
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules