![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
springboot任务
妙先森
这个作者很懒,什么都没留下…
展开
-
springboot定时执行任务
开启注解 @EnableScheduling //开启定时功能的注解 创建定时任务 在需要执行的定时任务上加上注解@Scheduled(cron = "0 51 15 * * ?") 其中corn表示你要在什么时间执行的属性。具体表达式见 Cron表达式生成器 //在一个特定的时间执行这个方法 //秒 分 时 日 月 周几~ @Scheduled(cron = "0 51 15 * * ?") public void hello(){ System.out.pr原创 2020-12-04 16:12:41 · 115 阅读 · 0 评论 -
springboot邮件任务
第一步:导入邮件任务的Starter 导入启动器 <!--javax.mail--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-mail</artifactId> </dependency> 第二步:开启邮箱原创 2020-12-04 15:25:51 · 401 阅读 · 0 评论 -
springboot异步任务
开启异步任务 在启动类上加上注解@EnableAsync @EnableAsync @SpringBootApplication public class SpringbootAsynchApplication { public static void main(String[] args) { SpringApplication.run(SpringbootAsynchApplication.class, args); } } 添加异步方法 在你要执行的方法上加上注解原创 2020-12-04 14:57:24 · 82 阅读 · 0 评论