본문 바로가기

Spring Boot/Spring Boot

36-1 : Springboot (요청 방식 & Controller)

BoardController

 

@RestController

  @Controller에 @ResponseBody가 결합된 어노테이션이다.

  @RestController를 붙이면 컨트롤러 클래스 하위 메소드에 @ResponseBody 어노테이션을 붙이지 않아도

  문자열과 JSON 등을 전송할 수 있다

 

 

@GetMapping 

  @RequestMapping(method = RequestMethod.GET) 와 같은 형태로

  GET 요청 방식의 API를 만들때 사용된다. (GET, POST, DELETE, PATCH) 방식이 있다

 

 

Service layer

@Service를 붙여주어 Spring에서 이 클래스가 Service인 것을 알 수 있다

 

'Spring Boot > Spring Boot' 카테고리의 다른 글

37 : Springboot (Board - Mybatis)  (0) 2021.09.29
36-2 : Springboot (Service)  (0) 2021.09.29
36 : Springboot (MyBatis를 이용하여 MySQL 연동)  (0) 2021.09.28
35 : BoilerPlate와 Lombok  (0) 2021.09.28
34 : Springboot 시작  (0) 2021.09.27