javaspringspring-boot

Configuring mvc async task executor in springboot application


I am trying to override the default task executor used by the RequestMappingHandlerAdapter bean in a SpringBoot/SpringMVC application.

The javadocs recommend to replace the use of the default but do not give any indication on how to do this nor can I find anything in the SpringBoot documentation.


Solution

  • The WebMvcConfigurer has a callback for configuring async support (https://github.com/spring-projects/spring-framework/blob/51d34fff64d1cdad2d09ab085de13f5a7b2e8dd2/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurer.java#L81).