码迷,mamicode.com
首页 > 其他好文 > 详细

定时任务

时间:2017-07-13 13:27:50      阅读:110      评论:0      收藏:0      [点我收藏+]

标签:int   ring   dao   not   task   pre   one   enc   text   

Naims_task.xml

<?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:p="http://www.springframework.org/schema/p"
  xmlns:task="http://www.springframework.org/schema/task"
  xmlns:context="http://www.springframework.org/schema/context"
  xmlns:aop="http://www.springframework.org/schema/aop" 
  xsi:schemaLocation="http://www.springframework.org/schema/beans  
  http://www.springframework.org/schema/beans/spring-beans-4.0.xsd 
  http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd  
  http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.0.xsd  
  http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd  
  http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd  
  http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.0.xsd">
<task:annotation-driven /> <!-- 定时器开关-->
 
  <bean id="myTask" class="com.wisoft.jazwfw.convenienceServices.controller.ConvenienceServicesController"></bean> 
 
  <task:scheduled-tasks> 
    <!-- 这里表示的是每天23点59分执行一次 -->
    <task:scheduled ref="myTask" method="getPubService" cron="0 59 23 * * ?" /> 
    <!-- 这里表示的是每隔十秒执行一次 -->
    <!-- <task:scheduled ref="myTask" method="print" cron="*/10 * * * * ?"/>  -->
  </task:scheduled-tasks> 
 
  <!-- 自动扫描的包名 -->
  <context:component-scan base-package="com.wisoft.jazwfw.convenienceServices.controller" /> 
  
</beans>

然后在Naims_main.xml引入

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
    <import resource="spring/Naims_ws.xml" />
    <import resource="spring/Naims_bo.xml" />
    <import resource="spring/Naims_dao.xml"/>
    <import resource="spring/Naims_params.xml"/>
    <import resource="spring/Naims_task.xml"/>
</beans>

 

定时任务

标签:int   ring   dao   not   task   pre   one   enc   text   

原文地址:http://www.cnblogs.com/jassy/p/7159871.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!