Skip to content

5주차 과제 제출#123

Open
incheol789 wants to merge 17 commits into
Loopers-play-dev-lab:incheol789from
incheol789:round5
Open

5주차 과제 제출#123
incheol789 wants to merge 17 commits into
Loopers-play-dev-lab:incheol789from
incheol789:round5

Conversation

@incheol789

Copy link
Copy Markdown
Collaborator

5주차 PR

구현 내용

@controller / @RequestMapping 애너테이션

  • @Controller@Component 메타 애너테이션 포함, 빈 자동 등록
  • @RequestMapping — 클래스/메서드 레벨 모두 지원, HTTP Method 매핑 추가
  • RequestMethod enum — 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]

  • LectureControllerController 인터페이스 구현 필수
  • handleRequest() 안에서 request.getMethod()로 직접 분기
  • HTTP Method별 로직 분리 불가

[After]

  • LectureController → 인터페이스 구현 없이 @Controller만 선언
  • GET/POST 메서드를 독립적으로 분리
  • DispatcherServletHandlerMapping/Adapter 기반으로 새 방식 추가 시 코드 변경 불필요

체크리스트

  • @Controller, @RequestMapping, RequestMethod 추가
  • HandlerKey, HandlerMethod 구현
  • HandlerMapping, HandlerAdapter 인터페이스 추가
  • AnnotationHandlerMapping@controller 스캔 및 URL+Method 매핑
  • AnnotationHandlerAdapter — HandlerMethod 리플렉션 실행
  • DispatcherServlet HandlerMapping/Adapter 기반으로 변경
  • LectureController 애너테이션 기반으로 마이그레이션
  • GET /lectures 페이지 정상 조회
  • POST /lectures 강의 등록 및 302 리다이렉트
  • 빌드 성공

jude-loopers and others added 17 commits April 12, 2026 23:32
…template-main

2주차 자바 웹 요청 추상화
- ApplicationContext: beans를 Map으로 변경하여 이름 기반 빈 관리
- @bean 애노테이션 추가 및 registerBeanMethods() 구현
- @RequestMapping 애노테이션 추가
- LectureController: @component, @RequestMapping("/lectures") 적용
- LectureApplication: 수동 컨트롤러 매핑 제거, getControllerMapping() 자동화
@incheol789 incheol789 self-assigned this May 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants