• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
呆呆重
博客园    首页    新随笔    联系   管理    订阅  订阅
spring4的定时器设置

主要架包:quartz-all-2.1.6.jar.

spring配置:

<?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:jaxws="http://cxf.apache.org/jaxws"  xsi:schemaLocation="   http://www.springframework.org/schema/beans   http://www.springframework.org/schema/beans/spring-beans-2.0.xsd   http://cxf.apache.org/jaxws   http://cxf.apache.org/schemas/jaxws.xsd">    

<bean id="complexJobDetail"   class="org.springframework.scheduling.quartz.JobDetailFactoryBean">   

<property name="jobClass" value="com.chebaobao.carinfo.action.CarInfoQuart" />   

<property name="jobDataMap">    

<map>    

<!--用到的service配置-->

<entry key="carInfoService" value-ref="carInfoService"></entry>    </map>   </property>   

<property name="durability" value="true" />  

</bean>

 <bean id="cronTrigger"   class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">   

<property name="jobDetail" ref="complexJobDetail" />

  <!-- 每周五 23点 -->   

<property name="cronExpression" value="0 0 23 ? * FRI" />  

</bean>  

<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">  

 <property name="jobDetails">    

<list>     

<ref bean="complexJobDetail" />   

 </list>  

 </property>

  <property name="triggers">   

 <list>    

 <ref bean="cronTrigger" />

   </list>  

 </property>  

</bean>

</beans>

posted on 2015-06-11 11:16  呆呆重  阅读(307)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3