title: Is it good to have dedicated ExecutorService for Spring Boot With Tomcat
body: <p>I have seen this code many times but don't know what is the advantage/disadvantage for it. In Spring Boot applications, I saw people define this bean.</p>
  
  <pre><code>@Bean
  @Qualifier("heavyLoadBean")
  public ExecutorService heavyLoadBean() {
      return Executors.newWorkStealingPool();
  }
  </code></pre>
  
  <p>Then whenever a CompletableFuture object is created in the service layer, that heavyLoadBean is used.</p>
  
  <pre><code>public CompletionStage&lt;T&gt; myService() {
     return CompletableFuture.supplyAsync(() -&gt; doingVeryBigThing(), heavyLoadBean);
  }
  </code></pre>
  
  <p>Then the controller will call the service.</p>
  
  <pre><code>@GetMapping("/some/path")
  public CompletionStage&lt;SomeModel&gt; doIt() {
     return service.myService();
  }
  </code></pre>
  
  <p>I don't see the point of doing that. Tomcat in Spring Boot has x number of threads. All the threads are used to process user requests. What is the point of using a different thread pool here? Anyway the user expects to see response coming back.</p>