title: Spring Boot Actuator 2.6.6 (initialising bean error)
body: <p>I get the following error message when trying to run my Spring Boot 2.6.6 project test cases with actuator:</p>
  <pre><code>Parameter 0 of method bindTaskExecutorsToRegistry in org.springframework.boot.actuate.autoconfigure.metrics.task.TaskExecutorMetricsAutoConfiguration required a bean of type 'java.util.Map' that could not be found.
  </code></pre>
  <p>Again, this issue only presents itself when trying to run @SpringBootTest integration tests.</p>
  <p>The @Autowired method:</p>
  <pre class="lang-java prettyprint-override"><code>  @Autowired
    public void bindTaskExecutorsToRegistry(Map&lt;String, Executor&gt; executors, MeterRegistry registry) {
      executors.forEach((beanName, executor) -&gt; {
        if (executor instanceof ThreadPoolTaskExecutor) {
          this.monitor(registry, this.safeGetThreadPoolExecutor((ThreadPoolTaskExecutor)executor), beanName);
        } else if (executor instanceof ThreadPoolTaskScheduler) {
          this.monitor(registry, this.safeGetThreadPoolExecutor((ThreadPoolTaskScheduler)executor), beanName);
        }
  
      });
    }
  </code></pre>
  <p><strong>EDIT:  Minimal reproducible project.</strong></p>
  <p>There is a configuration that exposes a <code>ThreadPoolTaskExecutor</code> for logging purposes.</p>
  <pre class="lang-java prettyprint-override"><code>@Configuration
  @EnableAsync
  public class DemoConfiguration {
  
    @Bean
    public ThreadPoolTaskExecutor threadPoolTaskExecutor() {
      ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
      executor.setCorePoolSize(10);
      executor.setMaxPoolSize(20);
      executor.setQueueCapacity(500);
      executor.setThreadNamePrefix(&quot;Thread&quot;);
      executor.setWaitForTasksToCompleteOnShutdown(true);
      executor.initialize();
      return executor;
    }
  }
  </code></pre>
  <p>When this configuration is injected into a @SpringTest, an exception is thrown:</p>
  <pre class="lang-java prettyprint-override"><code>@SpringBootTest
  class DemoApplicationTests {
  
    @MockBean
    DemoConfiguration configuration;
  
    @Test
    void contextLoads() {
      // User configuration.
    }
  }
  </code></pre>