spring 配置注解定时器quartz01
1、POJO方法:
@Service public class testSchdule { @Scheduled(cron="0/5 * * * * ? ") public static void syso(){ System.out.println("这是定时器!"); } }
2、引入包:quartz-2.2.2.jar
3、配置文件:
//新增
xmlns:task="http://www.springframework.org/schema/task" xsi:schemaLocation="http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd" <context:annotation-config />
//扫描 <context:component-scan base-package="com.rbao.east.test" /> //定时器模式 <task:annotation-driven scheduler="qbScheduler" mode="proxy"/> <task:scheduler id="qbScheduler" pool-size="10"/>
工作小总结,有错请指出,谢谢。