From a5ce3bde577272759721a5a764cf7919ff85b4ea Mon Sep 17 00:00:00 2001 From: gitchan Date: Mon, 25 Sep 2023 15:07:45 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20DispatcherServlet=EC=9D=84=20mvc=20?= =?UTF-8?q?=ED=8C=A8=ED=82=A4=EC=A7=80=EB=A1=9C=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- .../main/java/com/techcourse/AppWebApplicationInitializer.java | 1 + .../main/java/nextstep/mvc/controller}/DispatcherServlet.java | 3 +-- .../nextstep/mvc/controller/tobe}/ManualHandlerMapping.java | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) rename {app/src/main/java/com/techcourse => mvc/src/main/java/nextstep/mvc/controller}/DispatcherServlet.java (96%) rename {app/src/main/java/com/techcourse => mvc/src/main/java/nextstep/mvc/controller/tobe}/ManualHandlerMapping.java (96%) diff --git a/README.md b/README.md index c07df69098..6c26624fdb 100644 --- a/README.md +++ b/README.md @@ -16,4 +16,4 @@ - [x] DispatcherServlet이 아닌 뷰에서 JSP를 반환하도록 수정 - [x] REST API를 지원할 수 있도록 Json 뷰를 추가 - [x] Legacy MVC 제거 -- [ ] DispatcherServlet도 app 패키지가 아닌 mvc 패키지로 이동 +- [x] DispatcherServlet도 app 패키지가 아닌 mvc 패키지로 이동 diff --git a/app/src/main/java/com/techcourse/AppWebApplicationInitializer.java b/app/src/main/java/com/techcourse/AppWebApplicationInitializer.java index e091e7e249..5a23a00f20 100644 --- a/app/src/main/java/com/techcourse/AppWebApplicationInitializer.java +++ b/app/src/main/java/com/techcourse/AppWebApplicationInitializer.java @@ -1,6 +1,7 @@ package com.techcourse; import jakarta.servlet.ServletContext; +import nextstep.mvc.controller.DispatcherServlet; import nextstep.web.WebApplicationInitializer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/app/src/main/java/com/techcourse/DispatcherServlet.java b/mvc/src/main/java/nextstep/mvc/controller/DispatcherServlet.java similarity index 96% rename from app/src/main/java/com/techcourse/DispatcherServlet.java rename to mvc/src/main/java/nextstep/mvc/controller/DispatcherServlet.java index 0f53a7304d..a08cb1edef 100644 --- a/app/src/main/java/com/techcourse/DispatcherServlet.java +++ b/mvc/src/main/java/nextstep/mvc/controller/DispatcherServlet.java @@ -1,4 +1,4 @@ -package com.techcourse; +package nextstep.mvc.controller; import jakarta.servlet.ServletException; import jakarta.servlet.http.HttpServlet; @@ -34,7 +34,6 @@ public DispatcherServlet() { @Override public void init() { handlerMappings.addHandlerMapping(new AnnotationHandlerMapping("com.techcourse.controller")); - handlerMappings.addHandlerMapping(new ManualHandlerMapping()); handlerAdapters.addHandlerAdapter(new HandlerExecutionHandlerAdapter()); handlerAdapters.addHandlerAdapter(new ControllerHandlerAdapter()); diff --git a/app/src/main/java/com/techcourse/ManualHandlerMapping.java b/mvc/src/main/java/nextstep/mvc/controller/tobe/ManualHandlerMapping.java similarity index 96% rename from app/src/main/java/com/techcourse/ManualHandlerMapping.java rename to mvc/src/main/java/nextstep/mvc/controller/tobe/ManualHandlerMapping.java index 4a72a4127f..f427ccfcd5 100644 --- a/app/src/main/java/com/techcourse/ManualHandlerMapping.java +++ b/mvc/src/main/java/nextstep/mvc/controller/tobe/ManualHandlerMapping.java @@ -1,4 +1,4 @@ -package com.techcourse; +package nextstep.mvc.controller.tobe; import jakarta.servlet.http.HttpServletRequest; import nextstep.mvc.HandlerMapping;