pom.xml引入依赖
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
<version>2.2.1</version>
</dependency>
在spring配置文件中引入xsd
xmlns:task="http://www.springframework.org/schema/task"
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd
要执行的方法上加注解
@Scheduled(cron = "0/1 * * * * ? ")