Implementation of controllers

The following is the IndexController that caters the index URL:

@Controllerpublic class IndexController {    @GetMapping("/")    public String index() {        return "redirect:/article";    }}

The index method is mapped to the URL /, which will redirect to the /article URL when a GET request is received at that endpoint.

The following is the ArticleController, which is responsible for the CRUD operations of the Article domain model:

@Controller@RequestMapping("/article")public class ArticleController {    private final ArticleService articleService;    private final UserService userService;    public ArticleController(ArticleService articleService, UserService      userService) {        this.articleService = articleService;        this.userService  ...

Get Spring Boot 2.0 Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.