• 카테고리

    질문 & 답변
  • 세부 분야

    백엔드

  • 해결 여부

    미해결

HomeController 에서는 @GetMapping 이아닌 @RequestMapping를 사용하신 특별한 이유가 있나요?

21.04.28 15:28 작성 조회수 201

0

Note: This annotation can be used both at the class and at the method level. In most cases, at the method level applications will prefer to use one of the HTTP method specific variants @GetMapping, @PostMapping, @PutMapping, @DeleteMapping, or @PatchMapping.

들여다보니 이런내용이 있길래 궁금해서 물어봤습니다. 대부분의 경우가 아닌 사례가 있는가싶어서 물어보았습니다.

감사합니다.

답변 1

답변을 작성해보세요.

1

안녕하세요. 지호손님

특별한 이유는 없습니다.

@Get, @Post 어떤 요청이든 상관없이 홈을 보여주는 것이 목적입니다. 그런데 여기에는 @GetMapping이 더 적절합니다.

감사합니다.