springboot内置的定时任务简单使用 直接上图:搞定(一定要加@EnableScheduling(开启定时任务)这个注解@Component(让spring扫描到)),下面是每五秒执行一次 结果: