title: Can't use @Async in spring boot
body: <p>I want to use spring boot's Asynchronous mechanism, here is my code.</p>
  
  <pre><code>@Slf4j
  @Configuration
  @EnableAsync
  public class AsyncConfig implements AsyncConfigurer {
  
      private static final int MAX_POOL_SIZE = 50;
  
      private static final int CORE_POOL_SIZE = 20;
  
      @Override
      public Executor getAsyncExecutor() {
          ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor();
          taskExecutor.setBeanName("taskExecutor");
          taskExecutor.setMaxPoolSize(MAX_POOL_SIZE);
          taskExecutor.setCorePoolSize(CORE_POOL_SIZE);
          taskExecutor.setThreadNamePrefix("async-task-thread-pool");
          taskExecutor.setWaitForTasksToCompleteOnShutdown(true);
          taskExecutor.setAwaitTerminationSeconds(60 * 10);
          taskExecutor.setRejectedExecutionHandler(
              (r, executor) -&gt; log.warn("current thread pool is full, reject to invoke."));
          taskExecutor.initialize();
          return taskExecutor;
      }
  
      @Override
      public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
          return (ex, method, params) -&gt;
          {
              log.error("invoke async method occurs error. method: {}, params: {}",
                  method.getName(), JSON.toJSONString(params), ex);
              throw new RuntimeException();
          };
      }
  
  }
  </code></pre>
  
  <p>And I add the @Async annotation on another class' method.</p>
  
  <pre><code>@Override
  public Future&lt;Result&gt; getResult(String name); 
  </code></pre>
  
  <p>But when I call the <code>getResult()</code> method, it report <code>No bean named 'taskExecutor' available: No matching Executor bean found for qualifier 'taskExecutor' - neither qualifier match nor bean name match!</code>.</p>
  
  <p>And then I find this page:<a href="https://www.baeldung.com/spring-async" rel="nofollow noreferrer">https://www.baeldung.com/spring-async</a>. I follow this page's guide - remove the <code>@EnableAsync</code> annotation on <code>Application.class</code> and add to the <code>AsyncConfig.class</code>. But still got the same error message.It seems that <code>setBeanName()</code> method doesn't effect. Is my usage wrong?</p>
  
  <p>By the way, I've read the api doc of <code>EnableAsync</code>, it writes </p>
  
  <blockquote>
    <p><p>Note: In the above example the {@code ThreadPoolTaskExecutor} is not a fully managed Spring bean. Add the {@code @Bean} annotation to the {@code getAsyncExecutor()} method</p>
    
    <p>if you want a fully managed bean. In such circumstances it is no longer necessary to
    manually call the {@code executor.initialize()} method as this will be invoked
    automatically when the bean is initialized.</p>
  </blockquote>
  
  <p>What does the <code>not a fully managed Spring bean</code> mean? Which part of the bean not managed by Spring?</p>