quartz 与 Springmvc 4.0 整合

来源:互联网 发布:人脸识别门禁接线端口 编辑:程序博客网 时间:2024/06/15 02:08


quartz 与 Springmvc 4.0 整合 其实是很简单的,但是网络上面大多数都很久没有更新说明了


引入架包 pom.xml

<!-- https://mvnrepository.com/artifact/org.quartz-scheduler/quartz -->    <!--任务调度定时器工具-->    <dependency>      <groupId>org.quartz-scheduler</groupId>      <artifactId>quartz</artifactId>      <version>2.2.1</version>    </dependency>

配置:Springmvc-Servlet.xml


<!-- task任务扫描注解 --><task:annotation-driven scheduler="myScheduler" /><!--线程池--><task:scheduler id="myScheduler" pool-size="5"/><!--定时配置扫描注解--><context:component-scan base-package="com.olcps"></context:component-scan>

 备注:其他都头部 核对一下看一下是否已经添加了 未添加 就添加进入


<?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:task="http://www.springframework.org/schema/task"xmlns:context="http://www.springframework.org/schema/context"xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:aop="http://www.springframework.org/schema/aop"xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsdhttp://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.0.xsdhttp://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsdhttp://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsdhttp://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd">



0 0
原创粉丝点击