Spring Boot异步执行程序

1 在Spring Boot启动类上加@EnableAsync注解,开启异步。

2 在执行异步方法的类上加@Component注解,使该类被扫描到。

3 在需要一步的方法上加@Async注解,使之成为异步方法。

使用场景:发短信、发邮件、App消息推送等。

猜你喜欢

转载自blog.csdn.net/qwqw3333333/article/details/80339148
今日推荐