Using Spring Web MVC with servlet 3.x for the controller
Controllers are the integration point between the model and view in the MVC paradigm. They act like 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 servlet, Spring, and Tomcat dependencies to enable successfully writing servlet-based web applications using Spring.
Implementation of Controllers annotations
The following is CommentController
, which displays and saves comment:
@Controller public class CommentController { private final static Logger LOGGER = LoggerFactory.getLogger(CommentController.class); private final CommentService commentService...