Skip to content

Commit

Permalink
520 - Avoid warning message about wrong async task executor
Browse files Browse the repository at this point in the history
  • Loading branch information
ivicac committed Nov 22, 2024
1 parent 97159d7 commit 2c73c97
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions server/libs/config/async-config/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
dependencies {
implementation("org.slf4j:slf4j-api")
implementation("org.springframework:spring-webmvc")
implementation("org.springframework.boot:spring-boot-autoconfigure")
implementation(project(":server:libs:platform:platform-tenant:platform-tenant-api"))
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,17 @@
import org.slf4j.LoggerFactory;
import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
import org.springframework.aop.interceptor.SimpleAsyncUncaughtExceptionHandler;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.task.TaskExecutionProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.task.AsyncTaskExecutor;
import org.springframework.scheduling.annotation.AsyncConfigurer;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.web.servlet.config.annotation.AsyncSupportConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
* @author Ivica Cardic
Expand Down Expand Up @@ -69,4 +73,15 @@ public Executor getAsyncExecutor() {
public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
return new SimpleAsyncUncaughtExceptionHandler();
}

@Bean
protected WebMvcConfigurer webMvcConfigurer(@Qualifier("taskExecutor") Executor executor) {
return new WebMvcConfigurer() {

@Override
public void configureAsyncSupport(AsyncSupportConfigurer configurer) {
configurer.setTaskExecutor((AsyncTaskExecutor) executor);
}
};
}
}

0 comments on commit 2c73c97

Please sign in to comment.