1.启动类添加注解@EnableScheduling 2.定义类myTask 3.方法上添加注解 @Scheduled(cron = "0/30 * * * * ?") 七子表达式 》》》》eg:每30秒发送一次邮件