You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
섹션 6. 스프링 MVC - 기본 기능 (1)
1. 프로젝트 생성
프로젝트 생성
프로젝트 동작 확인

2. 로깅 간단히 알아보기
로깅 라이브러리
스프링 부트 라이브러리에 스프링 부트 로깅 라이브러리가 함께 포함된다
매핑 정보
@RestController테스트
TRACE > DEBUG > INFO > WARN > ERROR@Slf4j로 변경올바른 로그 사용법
log.debug("data="+data): 로그 출력 레벨을 info로 설정해도 문자 더하기 연산 발생log.debug("data={}", data): 로그 출력 레벨을 info로 설정해도 아무일도 발생하지 않는다로그 사용시 장점
3. 요청 매핑
매핑 정보
@RequestMapping("/hello-basic")/hello-basic으로 url이 오면 이 메서드가 실행됨{"/hello-basic", "/hello-go"}/hello-basic , /hello-basic/HTTP 메서드 매핑
@GetMapping과 같이 지정 가능PathVariable 사용
@RequestMapping은 URL 경로를 템플릿화 할 수 있는데,@PathVariable을 사용하면 매칭 되는 부분을편리하게 조회할 수 있다.
@PathVariable의 이름과 파라미터 이름이 같으면 생략 가능다중 사용 경우
특정 파라미터 조건 매핑
특정 파라미터가 있거나 없는 조건을 추가, 자주 사용하지는 않음
특정 헤더 조건 매핑
파라미터 매핑과 유사하지만 HTTP 헤더 사용, Postman으로 테스트해야함
4. 요청 매핑 - API 예시
회원 관리를 HTTP API로 만든다 생각하고 매핑 알아보기
@RequestMapping("/mapping/users"): 클래스 레벨에 매핑 정보를 두면 메서드 레벨에서 해당 정보를 조합, 사용All reactions