SSM框架 quartz跑步起来
来源:15-2 将Quartz引入到框架里
慕粉4229098
2018-03-13
<?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:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
<!-- 定义一个任务类 -->
<bean id="myJob" class="com.yuanlin.o2o.service.ProductSellDailyService"></bean>
<!-- jobDetail -->
<bean id="jobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="name" value="product_sell_daily_job"/>
<property name="group" value="job_product_sell_daily_group"/>
<property name="concurrent" value="false" /><!-- 作业不并发调度 -->
<property name="targetObject" ref="myJob"></property>
<property name="targetMethod" value="dailyCalculate"></property>
</bean>
<!-- 定义trigger 触发器 -->
<bean id="cronTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="name" value="product_sell_daily_trigger"/>
<property name="group" value="job_product_sell_daily_group"/>
<property name="jobDetail" ref="jobDetail"></property>
<property name="cronExpression" value="0/3 * * * * ? *"></property>
</bean>
<bean id="scheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="cronTrigger"/>
</list>
</property>
</bean>
</beans>
1回答
-
翔仔
2018-03-13
同学好,如果还没有解决quartz问题的能力,请严格参照视频或者最终源码去配置,那个是没问题的。如果想学习xml配置,也可以参照我的免费视频https://www.imooc.com/learn/846 去玩
00
相似问题