Blocking Controller and Repository

Learn how to create a blocking controller and a blocking repository and learn how they differ from their reactive counterparts.

We'll cover the following

To better show the comparison between the blocking and reactive approaches, let’s create a separate controller with different request paths, and connect them to a standard CrudRepository. This code is pretty straightforward and well-known to developers familiar with Spring Web MVC.

Blocking controller

Let’s look at the controller’s code.

Note, that here, we also apply the same delay (DELAY_PER_ITEM_MS on line 13) as in the reactive approach. However, this time, the delay is a big one (it adds up), since the query is returning results at once too.

Get hands-on with 1400+ tech skills courses.