From 84eb807cd0e977c4178bd2693f5da47189b9120f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=B5=E1=84=92=E1=85=A9=E1=84=8C=E1=85=AE?= =?UTF-8?q?=E1=86=AB?= Date: Sat, 28 Jun 2025 21:17:08 +0900 Subject: [PATCH] fix: Register async executor as a bean using @Bean - Fixes graceful shutdown failure for @Async tasks - Ensures the executor's lifecycle is managed by Spring - Removes redundant manual call to initialize() --- .../java/io/dodn/springboot/core/api/config/AsyncConfig.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/core-api/src/main/java/io/dodn/springboot/core/api/config/AsyncConfig.java b/core/core-api/src/main/java/io/dodn/springboot/core/api/config/AsyncConfig.java index 0594705..a6c012b 100644 --- a/core/core-api/src/main/java/io/dodn/springboot/core/api/config/AsyncConfig.java +++ b/core/core-api/src/main/java/io/dodn/springboot/core/api/config/AsyncConfig.java @@ -1,6 +1,7 @@ package io.dodn.springboot.core.api.config; import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler; +import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.annotation.AsyncConfigurer; import org.springframework.scheduling.annotation.EnableAsync; @@ -12,6 +13,7 @@ @EnableAsync public class AsyncConfig implements AsyncConfigurer { + @Bean @Override public Executor getAsyncExecutor() { ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); @@ -20,7 +22,6 @@ public Executor getAsyncExecutor() { executor.setQueueCapacity(10000); executor.setWaitForTasksToCompleteOnShutdown(true); executor.setAwaitTerminationSeconds(10); - executor.initialize(); return executor; }