xmlns:task="http://www.springframework.org/schema/task" 1 2.xsi加入:
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.1.xsd 12 3.任务扫描注解:
<task:executor id="executor" pool-size="5" /> <task:scheduler id="scheduler" pool-size="10" /> <task:annotation-driven executor="executor" scheduler="scheduler" /> 123 4.代码实现:
@Scheduled(cron = "0 0/10 * * * ?") //每隔十分钟执行一次 public void updateIndex(){ logger.info("test:{}", test); } 1234 5.cron表达式,使用时查询即可