5주차 과제 제출#123
Open
incheol789 wants to merge 17 commits into
Open
Conversation
…template-main 2주차 자바 웹 요청 추상화
- ApplicationContext: beans를 Map으로 변경하여 이름 기반 빈 관리 - @bean 애노테이션 추가 및 registerBeanMethods() 구현 - @RequestMapping 애노테이션 추가 - LectureController: @component, @RequestMapping("/lectures") 적용 - LectureApplication: 수동 컨트롤러 매핑 제거, getControllerMapping() 자동화
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
5주차 PR
구현 내용
@controller / @RequestMapping 애너테이션
@Controller—@Component메타 애너테이션 포함, 빈 자동 등록@RequestMapping— 클래스/메서드 레벨 모두 지원, HTTP Method 매핑 추가RequestMethodenum — GET, POST, PUT, DELETE 등HandlerKey & HandlerMethod
HandlerKey— URL + HTTP Method 조합 복합 키HandlerMethod— 리플렉션으로 컨트롤러 메서드 동적 실행HandlerMapping / HandlerAdapter 추상화
HandlerMapping인터페이스 — 요청에서 핸들러 탐색HandlerAdapter인터페이스 — 핸들러 실행 추상화SimpleUrlHandlerMapping— 기존 Controller 인터페이스 방식 유지AnnotationHandlerMapping— @controller 스캔 및 URL+Method 자동 매핑SimpleControllerHandlerAdapter— Controller 인터페이스 처리AnnotationHandlerAdapter— HandlerMethod 처리LectureController 마이그레이션
Controller인터페이스 구현 제거handleRequest()내부 GET/POST 수동 분기 제거@RequestMapping(methods = RequestMethod.GET/POST)선언변경 전후
[Before]
LectureController→Controller인터페이스 구현 필수handleRequest()안에서request.getMethod()로 직접 분기[After]
LectureController→ 인터페이스 구현 없이@Controller만 선언DispatcherServlet→HandlerMapping/Adapter기반으로 새 방식 추가 시 코드 변경 불필요체크리스트
@Controller,@RequestMapping,RequestMethod추가HandlerKey,HandlerMethod구현HandlerMapping,HandlerAdapter인터페이스 추가AnnotationHandlerMapping— @controller 스캔 및 URL+Method 매핑AnnotationHandlerAdapter— HandlerMethod 리플렉션 실행DispatcherServletHandlerMapping/Adapter 기반으로 변경LectureController애너테이션 기반으로 마이그레이션