title: Does Spring create new thread per request in rest controllers?
body: <p>I wanted to learn non blocking REST, but first I wrote blocking controller for comparison. To my surprise Spring doesn't block incoming requests.</p>
  <p>Simple blocking service:</p>
  <pre><code>@Service
  public class BlockingService {
  
      public String blocking() {
          try {
              Thread.sleep(10000L);
          } catch (InterruptedException ign) {}
          return &quot;Blocking response&quot;;
      }
  }
  </code></pre>
  <p>Simple REST controller:</p>
  <pre><code>@Slf4j
  @RestController
  public class BlockingRestController {
  
      private final BlockingService blockingService;
  
      @Autowired
      public BlockingRestController(BlockingService blockingService) {
          this.blockingService = blockingService;
      }
  
      @GetMapping(&quot;blocking&quot;)
      public String blocking() {
          log.info(&quot;Starting blocking request processing...&quot;);
          return blockingService.blocking();
      }
  }
  </code></pre>
  <p>And I was thinking that when I send 4 requests using curl from 4 separated terminals I get:</p>
  <pre><code>1. Starting blocking request processing... (console where spring is running)
  2. (4 terminals waiting)
  3. &quot;Blocking response&quot; (in 1st terminal)
  4. Starting blocking request processing... (console where spring is running)
  5. (3 terminals waiting)
  6. &quot;Blocking response&quot; (in 2nd terminal)
  And so on...
  </code></pre>
  <p>But to my surprise I got:</p>
  <pre><code>1. Starting blocking request processing... (console where spring is running)
  2. Starting blocking request processing... (console where spring is running)
  3. Starting blocking request processing... (console where spring is running)
  4. Starting blocking request processing... (console where spring is running)
  5. &quot;Blocking response&quot; (in 1st terminal)
  6. &quot;Blocking response&quot; (in 2nd terminal)
  7. &quot;Blocking response&quot; (in 3rd terminal)
  8. &quot;Blocking response&quot; (in 4th terminal)
  </code></pre>
  <p>Why first request doesn't block processing requests? Yet I don't create new threads and I don't process anything asynchronous?</p>
  <p>Why do I ask about it? Because I want to learn how to use <code>DeferredResult</code>, but now I don't see a need.</p>