SSM框架中配置定时任务
在xmlns中添加 xmlns: task = "http://www.springframework.org/schema/task" 在xsi中添加 http: //www .springframework .org /schema/task http: //www .springframework .org /schema/task/spring-task- 3.2 .xsd 在中间添加 <!-- 设置定时任务 --> < task:annotation-driven /> @Scheduled (cron = "0 0 0 * * ?" ) //每天晚上12点执行 public void gettime () { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); System.out.println( "current time" + format.parse(new Date() )); } “0 15 10 ? * MON-FRI” 每个周一、周二、周三、周四、周五的10:15触发 文章来源: SSM框架中配置定时任务