Using HandlerFunction
and RouterFunction
in exposing repository data is the major option that is the promoted by this chapter since everything is all about Spring 5. But there are also non-reactive ways of exposing these data using the conventional @RestController
and Spring REST that are still present in Spring Boot 2.0, which can be part of building reactive applications and microservices.
To implement REST services in Spring 5, follow these steps:
- To enable Spring REST support, add the following starter POM dependency:
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-rest</artifactId> </dependency>
- All the annotations of
SpringDataConfig
needed to implement Spring Data JPA are also needed here for Spring REST configuration. - Inside...