admin管理员组文章数量:1794759
applicationContext
/xml配置文件/其他配置/quatz配置/applicationContext-job.xml<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""
xmlns:xsi="" xmlns:context=""
xmlns:aop="" xmlns:tx=""
xsi:schemaLocation="
.xsd
.xsd
.xsd
.xsd
">
<!-- 定义一个任务类 -->
<bean id="testJobBean" class="cn.me.job.TJob"></bean>
<!-- 任务类描述,targetObject是任务类,targetMethod是该类要触发的方法 -->
<bean id="testJobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="testJobBean"></property>
<property name="targetMethod" value="send"></property>
</bean>
<!-- 触发器 -->
<bean id="testTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="jobDetail" ref="testJobDetail"></property>
<!-- 表达式,秒0-59 分0-59 时0-23 日1-31 月1-12 周1-7 年 -->
<property name="cronExpression" value="* * * * * ? *"></property>
</bean>
<!-- 总管理容器,spring启动会自动加载 -->
<bean id="startQuartz" class="org.springframework.scheduling.quartz.SchedulerFactoryBean" >
<property name="triggers">
<list>
<ref bean="testTrigger"/>
</list>
</property>
</bean>
</beans>
本文标签: ApplicationContext
版权声明:本文标题:applicationContext 内容由林淑君副主任自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.xiehuijuan.com/baike/1692638128a156076.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论