想吃苹果的蚂蚁
2017-07-12 16:18:49
spring的quartz任务调度task
1 .建立任务,使用注解方式
@Component
public class QuartzJob1 {
@Scheduled(cron="*/1 * * * * ?")
public void run(){
System.out.println("hello--->"+new Date());
}
}
2在spring配置文件中配置
<task:annotation-driven/>
<context:component-scan base-package="com.web.job"></context:component-scan>
3.就可以测试使用了
public static void main(String args[]){
AbstractApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
System.out.println(context);
}
评论
最近浏览
想吃苹果的蚂蚁 LV9
2017年7月23日


