diff --git a/application/src/main/java/net/furizon/backend/infrastructure/configuration/ThreadConfig.java b/application/src/main/java/net/furizon/backend/infrastructure/configuration/ThreadConfig.java deleted file mode 100644 index 3bd2c158..00000000 --- a/application/src/main/java/net/furizon/backend/infrastructure/configuration/ThreadConfig.java +++ /dev/null @@ -1,31 +0,0 @@ -package net.furizon.backend.infrastructure.configuration; - -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.boot.web.embedded.tomcat.TomcatProtocolHandlerCustomizer; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.core.task.AsyncTaskExecutor; -import org.springframework.core.task.support.TaskExecutorAdapter; -import org.springframework.scheduling.annotation.EnableAsync; - -import java.util.concurrent.Executors; - -@EnableAsync -@Configuration -@ConditionalOnProperty( - value = "spring.thread-executor", - havingValue = "virtual" -) -public class ThreadConfig { - @Bean - public AsyncTaskExecutor applicationTaskExecutor() { - return new TaskExecutorAdapter(Executors.newVirtualThreadPerTaskExecutor()); - } - - @Bean - public TomcatProtocolHandlerCustomizer protocolHandlerVirtualThreadExecutorCustomizer() { - return protocolHandler -> { - protocolHandler.setExecutor(Executors.newVirtualThreadPerTaskExecutor()); - }; - } -} diff --git a/application/src/main/java/net/furizon/backend/infrastructure/security/configuration/SecurityThreadConfiguration.java b/application/src/main/java/net/furizon/backend/infrastructure/security/configuration/SecurityThreadConfiguration.java index 2fd971e0..3ff99c3a 100644 --- a/application/src/main/java/net/furizon/backend/infrastructure/security/configuration/SecurityThreadConfiguration.java +++ b/application/src/main/java/net/furizon/backend/infrastructure/security/configuration/SecurityThreadConfiguration.java @@ -19,7 +19,7 @@ public class SecurityThreadConfiguration { @Bean(SESSION_THREAD_POOL_TASK_EXECUTOR) public Executor sessionThreadPoolTaskExecutor() { final var corePoolUpdateSize = securityConfig.getSession().getCorePoolUpdateSize(); - final var executor = new ThreadPoolTaskExecutor(); + ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); executor.setCorePoolSize(corePoolUpdateSize); executor.setMaxPoolSize(corePoolUpdateSize); executor.setThreadNamePrefix("session-thread-"); diff --git a/application/src/main/resources/application.yml b/application/src/main/resources/application.yml index b906f641..0484b2f0 100644 --- a/application/src/main/resources/application.yml +++ b/application/src/main/resources/application.yml @@ -2,10 +2,6 @@ server: port: ${BACKEND_SERVER_PORT:9090} spring: - threads: - virtual: - enabled: true - thread-executor: virtual jpa: open-in-view: false application: