Performance3 - SpotBugsExtensionForSpringFrameWork/CS5098 GitHub Wiki
@Async
annotation with default TaskExecutor
Performance - Do not use Description
While @Async
annotation provides developers an conveninent way to implement asynchonous method in Spring Application, the default TaskExecutor
is SimpleAsyncTaskExecutor
. However using SimpleAsyncTaskExecutor
is not a good practice since it's not a real implementation of thread pool.
Bug pattern
Just using @Async
without any configuration.
Solution
In this case, the most improtant thing is to customize executor
. We have three ways to configure this.
- Implements
AsyncConfigurer
- Extends
AsyncConfigurerSupport
- Customize bean name as "taskExecutor"