I am upgrading Spring Boot version from 2.4.6 to 2.6.6
After upgrade, one of the class failed to load and giving an error like below:
Failed to instantiate [java.util.concurrent.Executor]: Illegal arguments to factory method 'threadPoolTaskExecutor'; args: ; nested exception is java.lang.IllegalArgumentException: object is not an instance of declaring class
It failed to create a instance of executor service class.
This is the code:
@Configuration
@EnableAsync
public class ApplicationAsynchConfig implements AsyncConfigurer{
@Bean(name = "threadPoolTaskExecutor")
public Executor threadPoolTaskExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
//set some properties
return executor;
}
}
Any idea what is going wrong with the new Spring Boot version for this?