Serving a reactive template
So far, we’ve built a reactive controller that serves up some serialized JSON. But most websites need to render HTML. And this leads us to templates.
Since we’re talking about reactive programming, it makes sense to pick a templating engine that doesn’t block. So, for this chapter, we’ll be using Thymeleaf.
To get going, first, we need to update the application we started building at the beginning of this chapter. To do that, let’s revisit https://start.spring.io.
We’ve done this dance in previous chapters. Instead of making an entirely new project and starting over (ugh!), instead, we will enter all the same project metadata shown earlier in this chapter in the Creating a reactive Spring Boot application section.
This time, enter the following dependencies:
- Spring Reactive Web
- Thymeleaf
Now, instead of using GENERATE like we did last time, hit the EXPLORE button. This will cause the...