From 43430cf6b6cbe2f5f62b4d65304cc933e73cb1a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EB=B0=B1=ED=96=89?= Date: Wed, 1 Jul 2026 07:17:30 +0900 Subject: [PATCH 1/3] =?UTF-8?q?refactor:=20=EB=B6=88=ED=95=84=EC=9A=94?= =?UTF-8?q?=ED=95=9C=20import=20=EB=B0=8F=20PathVariable=20name=20?= =?UTF-8?q?=EC=86=8D=EC=84=B1=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../example/sample/web/EgovSampleController.java | 14 +++++++------- .../service/impl/EgovSampleServiceImplTest.java | 2 -- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/main/java/egovframework/example/sample/web/EgovSampleController.java b/src/main/java/egovframework/example/sample/web/EgovSampleController.java index a6d9450..9c3d410 100644 --- a/src/main/java/egovframework/example/sample/web/EgovSampleController.java +++ b/src/main/java/egovframework/example/sample/web/EgovSampleController.java @@ -65,7 +65,7 @@ public class EgovSampleController { private EgovPropertyService propertiesService; @GetMapping("/") - public String index(@ModelAttribute("sampleVO") SampleVO sampleVO, ModelMap model) throws Exception { + public String index(@ModelAttribute SampleVO sampleVO, ModelMap model) throws Exception { return this.selectSampleList(sampleVO, model); } @@ -77,7 +77,7 @@ public String index(@ModelAttribute("sampleVO") SampleVO sampleVO, ModelMap mode * @exception Exception */ @GetMapping("/egovSampleList.do") - public String selectSampleList(@ModelAttribute("sampleVO") SampleVO sampleVO, ModelMap model) throws Exception { + public String selectSampleList(@ModelAttribute SampleVO sampleVO, ModelMap model) throws Exception { /** EgovPropertyService.sample */ sampleVO.setPageUnit(propertiesService.getInt("pageUnit")); @@ -115,7 +115,7 @@ public String selectSampleList(@ModelAttribute("sampleVO") SampleVO sampleVO, Mo * @exception Exception */ @PostMapping("/addSampleView.do") - public String addSampleView( @ModelAttribute("sampleVO") SampleVO sampleVO, Model model) throws Exception { + public String addSampleView( @ModelAttribute SampleVO sampleVO, Model model) throws Exception { model.addAttribute("sampleVO", sampleVO); @@ -130,7 +130,7 @@ public String addSampleView( @ModelAttribute("sampleVO") SampleVO sampleVO, Mode * @exception Exception */ @PostMapping("/addSample.do") - public String addSample(@Valid @ModelAttribute("sampleVO") SampleVO sampleVO, BindingResult bindingResult, Model model, SessionStatus status) throws Exception { + public String addSample(@Valid @ModelAttribute SampleVO sampleVO, BindingResult bindingResult, Model model, SessionStatus status) throws Exception { if (bindingResult.hasErrors()) { model.addAttribute("sampleVO", sampleVO); @@ -151,7 +151,7 @@ public String addSample(@Valid @ModelAttribute("sampleVO") SampleVO sampleVO, Bi * @exception Exception */ @PostMapping("/updateSampleView.do") - public String updateSampleView(@ModelAttribute("sampleVO") SampleVO sampleVO, Model model) throws Exception { + public String updateSampleView(@ModelAttribute SampleVO sampleVO, Model model) throws Exception { SampleVO detail = sampleService.selectSample(sampleVO); detail.setSearchCondition(sampleVO.getSearchCondition()); @@ -171,7 +171,7 @@ public String updateSampleView(@ModelAttribute("sampleVO") SampleVO sampleVO, Mo * @exception Exception */ @PostMapping("/updateSample.do") - public String updateSample(@Valid @ModelAttribute("sampleVO") SampleVO sampleVO, BindingResult bindingResult, + public String updateSample(@Valid @ModelAttribute SampleVO sampleVO, BindingResult bindingResult, Model model, RedirectAttributes redirectAttributes, SessionStatus status) throws Exception { if (bindingResult.hasErrors()) { @@ -197,7 +197,7 @@ public String updateSample(@Valid @ModelAttribute("sampleVO") SampleVO sampleVO, * @exception Exception */ @PostMapping("/deleteSample.do") - public String deleteSample(@ModelAttribute("sampleVO") SampleVO sampleVO, RedirectAttributes redirectAttributes, SessionStatus status) throws Exception { + public String deleteSample(@ModelAttribute SampleVO sampleVO, RedirectAttributes redirectAttributes, SessionStatus status) throws Exception { sampleService.deleteSample(sampleVO); status.setComplete(); diff --git a/src/test/java/egovframework/example/sample/service/impl/EgovSampleServiceImplTest.java b/src/test/java/egovframework/example/sample/service/impl/EgovSampleServiceImplTest.java index f51dcb4..dad4727 100644 --- a/src/test/java/egovframework/example/sample/service/impl/EgovSampleServiceImplTest.java +++ b/src/test/java/egovframework/example/sample/service/impl/EgovSampleServiceImplTest.java @@ -18,7 +18,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -34,7 +33,6 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; -import org.springframework.test.util.ReflectionTestUtils; import egovframework.example.sample.service.SampleVO; From 584fb0cb7a4a7c398b858fe33054b2d9d34832dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EB=B0=B1=ED=96=89?= Date: Wed, 1 Jul 2026 20:55:32 +0900 Subject: [PATCH 2/3] =?UTF-8?q?=EB=B0=98=EC=98=81=20=EC=A0=84=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 컨트롤러 의존성 주입이 일부만 정리됨 생성자 주입으로 전환 --- .../example/sample/web/EgovSampleController.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/java/egovframework/example/sample/web/EgovSampleController.java b/src/main/java/egovframework/example/sample/web/EgovSampleController.java index 9c3d410..7113b9f 100644 --- a/src/main/java/egovframework/example/sample/web/EgovSampleController.java +++ b/src/main/java/egovframework/example/sample/web/EgovSampleController.java @@ -31,8 +31,8 @@ import egovframework.example.sample.service.EgovSampleService; import egovframework.example.sample.service.SampleVO; -import jakarta.annotation.Resource; import jakarta.validation.Valid; +import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; /** @@ -53,16 +53,15 @@ */ @Controller +@RequiredArgsConstructor @Slf4j public class EgovSampleController { /** EgovSampleService */ - @Resource(name = "sampleService") - private EgovSampleService sampleService; + private final EgovSampleService sampleService; /** EgovPropertyService */ - @Resource(name = "propertiesService") - private EgovPropertyService propertiesService; + private final EgovPropertyService propertiesService; @GetMapping("/") public String index(@ModelAttribute SampleVO sampleVO, ModelMap model) throws Exception { From 60e94681ed245d0ddb12ac56bf94caa051985d8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EB=B0=B1=ED=96=89?= Date: Wed, 1 Jul 2026 21:02:30 +0900 Subject: [PATCH 3/3] =?UTF-8?q?=EC=88=98=EC=A0=95=EB=82=B4=EC=9A=A9=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../egovframework/example/sample/web/EgovSampleController.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/egovframework/example/sample/web/EgovSampleController.java b/src/main/java/egovframework/example/sample/web/EgovSampleController.java index 7113b9f..dd3f8b1 100644 --- a/src/main/java/egovframework/example/sample/web/EgovSampleController.java +++ b/src/main/java/egovframework/example/sample/web/EgovSampleController.java @@ -43,6 +43,7 @@ * @ 수정일 수정자 수정내용 * @ --------- --------- ------------------------------- * @ 2009.03.16 최초생성 + * @ 2026.07.01 [2026년 컨트리뷰션] 불필요한 import 및 ModelAttribute name 속성 제거 * * @author 개발프레임웍크 실행환경 개발팀 * @since 2009. 03.16