Replies: 2 comments 2 replies
|
귣귣 ! 👏 |
0 replies
|
점점 정리가 퀄리티가 높아지네요 ㅎㅎ |
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
✏️ 프로젝트 생성
webapp경로도 사용하지 않는다. 즉, 내장 서버 사용에 최적화 되어 있는 기능이다.Annotation Processors에 가서enable annotaion processing체크하기 !🔍 Welcome 페이지 만들기
Jar를 사용하면/resources/static/위치에index/html파일을 두면 Welcome 페이지로 처리해준다./index.html이 있으면 된다 !✏️ 로깅 간단히 알아보기
⭐ 운영 시스템에서는
System.out.println()같은 시스템 콘솔을 사용해서 정보를 출력하지 않고, 로깅 라이브러리를 사용해서 로그 를 출력한다.LogTestController⭐ 올바른 로그 사용법
log.debug("data="+data)log.debug("data={}", data)로그 사용시 장점
✏️ 요청 매핑
MappingController🔍 HTTP 메서드
@RequestMapping에method속성으로 HTTP 메서드를 지정하지 않으면 HTTP 메서드와 무관하게 호출된다.🔍 HTTP 메서드 매핑
🔍 HTTP 메서드 매핑 축약
🔍 PathVariable(경로 변수) 사용
@RequestMapping은 URL 경로를 템플릿화 할 수 있는데,@PathVariable을 사용하면 매칭 되는 부분을 편리하게 조회할 수 있다.@PathVariable의 이름과 파라미터 이름이 같으면 생략할 수 있다.🔍 PathVariable 사용 - 다중
🔍 특정 파라미터 조건 매핑
🔍 특정 헤더 조건 매핑
🔍 미디어 타입 조건 매핑 - HTTP 요청 Content-Type
🔍 미디어 타입 조건 매핑 - HTTP 요청 Accept, produce
✏️ 요청 매핑 - API 예시
🔍 회원 관리 API
회원 목록 조회 : GET
/users회원 등록 : POST
/users회원 조회 : GET
/users/{userId}회원 수정 : PATCH
/users/{userId}회원 삭제 : DELETE
/users/{userId}MappingClassController/mapping은 다른 예제들과 구별하기 위해 사용함.@RequestMapping("/mapping/users")Postman 으로 테스트
회원 목록 조회 : GET
/mapping/users회원 등록 : POST
/mapping/users회원 조회 : GET
/mapping/users/id1회원 수정 :PATCH
/mapping/users/id1회원 삭제 : DELETE
/mapping/users/id1url은 같고 method를 사용하여 구분한다.
🔗출처
All reactions