home/roleplay/prompt-spring-mvc-deep-dive

Prompt Spring Mvc Deep Dive

GPTClaudeGemini··339 copies·updated 2026-07-14
prompt-spring-mvc-deep-dive.prompt
# Spring MVC Deep Dive 레포지토리 제작 프롬프트

나는 "Spring MVC Deep Dive" 레포지토리를 만들려고 해.
DispatcherServlet이 HTTP 요청을 어떻게 처리하는지, @RequestMapping이 메서드와 어떻게 매핑되는지 완전히 파헤치는 레포를 만들 거야.

## 📋 프로젝트 목표

**컨셉**: "HTTP 요청이 Controller 메서드에 도달하는 전체 여정"

**핵심 차별화**:
1. DispatcherServlet.doDispatch() 메서드 한 줄씩 분석
2. HandlerMapping → HandlerAdapter → ViewResolver 전체 체인
3. @RequestBody가 객체가 되는 과정 (HttpMessageConverter)
4. Exception이 JSON으로 변환되는 메커니즘

**타겟 독자**:
- 매일 @RestController를 쓰지만 내부 동작을 모르는 개발자
- DispatcherServlet 면접 질문에 막히는 개발자
- ArgumentResolver, ReturnValueHandler를 커스터마이징해야 하는 개발자
- @ExceptionHandler가 어떻게 동작하는지 궁금한 개발자

**선행 학습**:
- Spring Core Deep Dive (AOP, Proxy 이해 필수)
- 독립적 학습도 가능 (MVC는 별도 영역)

---

## 🎯 1단계: 전체 구조 설계

다음 7개 챕터로 레포지토리를 설계해줘:

### Chapter 1: DispatcherServlet Architecture (7개 문서)
- Servlet과 Front Controller 패턴
- DispatcherServlet 초기화 과정 (onRefresh)
- WebApplicationContext vs RootApplicationContext 계층 구조
- HTTP Request 처리 전체 흐름 (doDispatch 분석)
- HandlerMapping 체인 동작
- HandlerAdapter의 역할
- ViewResolver 메커니즘

### Chapter 2: Request Mapping (7개 문서)
- @RequestMapping 처리 과정 (RequestMappingHandlerMapping)
- RequestMappingInfo 생성과 매칭
- Path Pattern 매칭 전략 (AntPathMatcher vs PathPattern)
- HTTP Method 매칭 (GET, POST, PUT, DELETE)
- Content Negotiation (Accept 헤더)
- URI Template Variables 추출
- Matrix Variables와 사용 시점

### Chapter 3: Argument Resolution (7개 문서)
- HandlerMethodArgumentResolver 체인
- @RequestBody와 HttpMessageConverter (JSON → Object)
- @RequestParam vs @PathVariable 처리
- @ModelAttribute 데이터 바인딩 과정
- Validation (@Valid, BindingResult) 동작 원리
- Servlet API 주입 (HttpServletRequest, HttpSession)
- Custom Argument Resolver 작성

### Chapter 4: Response Handling (6개 문서)
- HandlerMethodReturnValueHandler 체인
- @ResponseBody 처리 (Object → JSON)
- ResponseEntity vs @ResponseStatus 선택
- HttpMessageConverter 선택 과정 (canWrite 체크)
- Content Negotiation과 Accept 헤더
- Custom Return Value Handler 작성

### Chapter 5: Exception Handling (6개 문서)
- HandlerExceptionResolver 체인 동작
- @ExceptionHandler 메서드 매칭 과정
- @ControllerAdvice 적용 범위 (basePackages, annotations)
- ResponseEntityExceptionHandler 내부 구조
- Custom Error Response 설계
- Exception 처리 우선순위와 상속

### Chapter 6: Interceptor & Filter (6개 문서)
- Filter vs HandlerInterceptor 차이점
- HandlerInterceptor 체인 실행 순서
- preHandle → postHandle → afterCompletion 호출 시점
- CORS 처리 (CorsFilter, @CrossOrigin)
- Custom Interceptor 작성 패턴
- Async Request와 Interceptor

### Chapter 7: Advanced MVC Topics (6개 문서)
- Async Request Processing (@Async, Callable, DeferredResult)
- Server-Sent Events (SSE) 구현
- File Upload (MultipartResolver, MultipartFile)
- Static Resources Handling (ResourceHandler)
- HTTP Caching (Cache-Control, ETag)
- WebMvcConfigurer 커스터마이징

---

각 챕터는 **6~7개 문서**로 구성해줘. 총 **45개 문서** 목표.

**문서 구조**:

when to use it

Community prompt sourced from the open-source GitHub repo e9ua1/prompt-blueprints (no explicit license). A "Prompt Spring Mvc Deep Dive" style prompt — adapt the placeholders and specifics to your task. Imported as-is and not independently retested here, so check the output before relying on it.

tags

roleplaycommunitygeneral

source

e9ua1/prompt-blueprints · no explicit license