扫二维码与项目经理沟通
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流
1、任务执行和调度
Spring用TaskExecutor和TaskScheduler接口提供了异步执行和调度任务的抽象。
Spring的TaskExecutor和java.util.concurrent.Executor接口时一样的,这个接口只有一个方法execute(Runnable task)。
1.1、TaskExecutor类型
Spring已经内置了许多TaskExecutor的实现,你没有必要自己去实现:
1.2、注解支持调度和异步执行
To enable support for @Scheduled and @Async annotations add @EnableScheduling and @EnableAsync to one of your
@Configuration classes: @Configuration @EnableAsync @EnableScheduling public class AppConfig { }
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流