Using Spring Web MVC for the REST controller
Controllers are the integration point between the model and view in the MVC paradigm. They act like the glue that binds together everything while taking care of business logic execution and routing. The following Maven starter dependency
needs to be added to enable Spring Web MVC:
<dependencies> ... <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> </dependencies>
The preceding dependency
will import the servlet, Spring, and Tomcat dependencies to enable the successful writing of servlet-based web applications using Spring.
Implementation of controller annotations
The following is UserController
, which enables reset password for User
and the listing of users in the User Registration
module:
@RestController @RequestMapping("/users") public class UserController { private final AsyncService asyncService; private...