Hi Minella,
Here is my configuration:
Code:
<bean id="taskExecutor" class="org.springframework.core.task.SimpleAsyncTaskExecutor"/>
<bean id="articleReader" class="a.b.c.ThreadSafeHibernateCursorItemReader" scope="step">
<property name="sessionFactory" ref="sessionFactory" />
<property name="queryString" value="select o.id from Article o where o.status = 4" />
<property name="useStatelessSession" value="true" />
<property name="saveState" value="false" />
</bean>
<bean id="crawlingProcessor" class="a.b.c.CrawlingProcessor" scope="step" autowire="byType">
<property name="processingRuleParser">
<bean class="a.b.c.ProcessingRule">
<property name="config" value="#{jobParameters['config.folder']}/processing.conf"/>
<property name="resources" value="#{jobParameters['config.folder']}/*.xml"/>
</bean>
</property>
</bean>
<batch:job id="ArticlesJob">
<batch:step id="ArticlesStep1">
<batch:tasklet task-executor="taskExecutor" throttle-limit="5">
<batch:chunk commit-interval="5" reader="articleReader" processor="crawlingProcessor" writer="nullWriter" skip-limit="10">
<batch:skippable-exception-classes>
<batch:include class="org.springframework.orm.hibernate3.HibernateOptimisticLockingFailureException"/>
<batch:include class="org.springframework.dao.CannotAcquireLockException"/>
<batch:include class="org.springframework.dao.OptimisticLockingFailureException"/>
<batch:include class="org.hibernate.StaleObjectStateException"/>
</batch:skippable-exception-classes>
</batch:chunk>
</batch:tasklet>
</batch:step>
</batch:job>
Most of the spring batch admin context bean is used as default.
The only thing is that I have a transaction manager defined in a applicationContext.xml of a common library:
Code:
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
Thanks.