|
|
@@ -0,0 +1,28 @@
|
|
|
+package com.kcim.common.config;
|
|
|
+
|
|
|
+import org.springframework.context.annotation.Bean;
|
|
|
+import org.springframework.context.annotation.Configuration;
|
|
|
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
|
|
+
|
|
|
+import java.util.concurrent.Executor;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @program: CostAccount
|
|
|
+ * @description:
|
|
|
+ * @author: Wang.YS
|
|
|
+ * @create: 2025-07-04 19:15
|
|
|
+ **/
|
|
|
+
|
|
|
+@Configuration
|
|
|
+public class AsyncConfig {
|
|
|
+ @Bean("asyncTaskExecutor")
|
|
|
+ public Executor asyncTaskExecutor() {
|
|
|
+ ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
|
|
+ executor.setCorePoolSize(10);
|
|
|
+ executor.setMaxPoolSize(20);
|
|
|
+ executor.setQueueCapacity(50);
|
|
|
+ executor.setThreadNamePrefix("Async-");
|
|
|
+ executor.initialize();
|
|
|
+ return executor;
|
|
|
+ }
|
|
|
+}
|