5

I must put my own Executor to work with Spring @Async annotation. For this, I wrote the class along the lines

@Configuration
@EnableAsync
public class ConnectedThreads implements AsyncConfigurer {

  @Override
  public Executor getAsyncExecutor() {
    return ...

When I try to run the Spring Boot application with this class, the applications crashes with

Caused by: java.lang.IllegalStateException: Only one AsyncConfigurer may exist
    at org.springframework.scheduling.annotation.AbstractAsyncConfiguration.setConfigurers(AbstractAsyncConfiguration.java:68)

There is no another configurer in the project. It is a very small project, and I have full control over it. I myself suspect that the custom configurer may simply conflict with the default configurer.

Is there any possibility to say to Spring that THIS is the configurer I need and it should not look for any other?

M. Deinum
  • 115,695
  • 22
  • 220
  • 224
Audrius Meškauskas
  • 20,936
  • 12
  • 75
  • 93

0 Answers0