只需要在方法上加入@Scheduled注解
@Scheduled(cron = "0 */1 * * * ?")
public void job() throws JobExecutionException {
}
然后在Application中加入// @EnableScheduling注解
@EnableAutoConfiguration
// @EnableScheduling
@SpringBootApplication
public class OWSAppliction {
public static void main(String[] args) throws Exception {
SpringApplication.run(OWSAppliction.class);
}
}