Skip to content

Commit 19c4b9d

Browse files
authored
Merge pull request #27 from psh10066/main
fix: Register async executor as a bean using @bean
2 parents bf7a23b + 84eb807 commit 19c4b9d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

core/core-api/src/main/java/io/dodn/springboot/core/api/config/AsyncConfig.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package io.dodn.springboot.core.api.config;
22

33
import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
4+
import org.springframework.context.annotation.Bean;
45
import org.springframework.context.annotation.Configuration;
56
import org.springframework.scheduling.annotation.AsyncConfigurer;
67
import org.springframework.scheduling.annotation.EnableAsync;
@@ -12,6 +13,7 @@
1213
@EnableAsync
1314
public class AsyncConfig implements AsyncConfigurer {
1415

16+
@Bean
1517
@Override
1618
public Executor getAsyncExecutor() {
1719
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
@@ -20,7 +22,6 @@ public Executor getAsyncExecutor() {
2022
executor.setQueueCapacity(10000);
2123
executor.setWaitForTasksToCompleteOnShutdown(true);
2224
executor.setAwaitTerminationSeconds(10);
23-
executor.initialize();
2425
return executor;
2526
}
2627

0 commit comments

Comments
 (0)