0
我使用以下作業啓動器來啓動我的spring批處理作業,我想運行一個名爲Notify的類,我如何配置它?無法配置Spring批處理來運行java類嗎?
這是我的工作文件:
<context:component-scan base-package="com.mkyong" />
<!-- stored job-meta in memory -->
<bean id="jobRepository"
class="org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean">
<property name="transactionManager" ref="transactionManager" />
</bean>
<bean id="transactionManager" class="org.springframework.batch.support.transaction.ResourcelessTransactionManager" />
<bean id="jobLauncher"
class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
<property name="jobRepository" ref="jobRepository" />
</bean>
<bean id="report" class="com.mkyong.model.Report" scope="prototype" />
<bean id="customWriter" class="com.mkyong.writers.CustomWriter" />
<bean id="notify" class="com.mkyong.model.Notify" />
<constructor-arg>
<bean class="org.springframework.batch.core.repository.dao.MapJobInstanceDao"/>
</constructor-arg>
</bean>
<bean id="runScheduler" class="com.mkyong.RunScheduler" />
<!-- Run every 5 seconds -->
<task:scheduled-tasks>
<!-- <task:scheduled ref="runScheduler" method="run" fixed-delay="5000"
/> -->
<task:scheduled ref="runScheduler" method="run"
cron="*/20 * * * * *" />
</task:scheduled-tasks>
</beans>
「run」是什麼意思?該xml中的notify類似乎是模型的一部分,(只是一個Java Bean)。並且該代碼已經清楚地從mkyong.com網頁上粘貼... –