title: Spring integration test consumes a lot of memory, uses a high number of duplicate threads in GradleWorkerMain
body: <p>I have a somewhat complicated Spring Boot app, with a large number of tests.</p>
  
  <p>When running the tests, it seems to be accumulating a lot of threads, one of which there is multiple instances of and is called <code>SimplePauseDetectorThread_0</code>, which I traced down to this dependency</p>
  
  <pre><code>|    |    |    \--- io.micrometer:micrometer-core:1.1.1
  |    |    |         +--- org.latencyutils:LatencyUtils:2.0.3
  </code></pre>
  
  <p>This seems to happen on Spring Boot 2.0.6 as well as 2.1.1.</p>
  
  <p>A typical test may look like this:</p>
  
  <pre><code>@RunWith(SpringJUnit4ClassRunner.class)
  @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.MOCK)
  @ActiveProfiles(profiles = {"test"})
  public class MyTest {
  [...]
  </code></pre>
  
  <p>My actuator config looks like this:</p>
  
  <pre><code>management.endpoints.enabled-by-default=false
  management.endpoint.prometheus.enabled=true
  management.endpoints.web.base-path=/
  management.endpoints.web.exposure.include=prometheus
  management.endpoints.web.path-mapping.prometheus=prometheus
  spring.metrics.prometheus.enabled=true
  </code></pre>
  
  <p>See attached screenshot</p>
  
  <p><a href="https://i.stack.imgur.com/lNB7D.png" rel="noreferrer"><img src="https://i.stack.imgur.com/lNB7D.png" alt="enter image description here"></a></p>