Does spring @Scheduled annotated methods runs on different threads?

前端 未结 8 2363
时光取名叫无心
时光取名叫无心 2020-11-30 01:19

I have several methods annotated with @Scheduled(fixedDelay=10000).

In the application context, I have this annotation-driven setup:

<         


        
8条回答
  •  不知归路
    2020-11-30 01:30

    you can use:

    @Bean()
    public  ThreadPoolTaskScheduler  taskScheduler(){
        ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler();
        taskScheduler.setPoolSize(2);
        return  taskScheduler;
    }
    

提交回复
热议问题