반응형
Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| 8 | 9 | 10 | 11 | 12 | 13 | 14 |
| 15 | 16 | 17 | 18 | 19 | 20 | 21 |
| 22 | 23 | 24 | 25 | 26 | 27 | 28 |
Tags
- 맥
- 오블완
- 개발
- androidstudio
- vsCode
- pydantic
- fastapi
- VirtualBox
- webpack
- 센토스
- localserver
- centos
- 티스토리챌린지
- 리눅스
- PYTHON
- Android
- ReactNative
- node
- 네트워크
- MachineLearning
- build
- xcode
- Chrome
- linux
- IOS
- TensorFlow
- unittest
- react
- MAC
Archives
- Today
- Total
로메오의 블로그
[Spring Boot] 프로젝트 구조 정리하기 본문
반응형
Spring Boot / Oracle / Mybatis 차례
여기까지 잘 따라왔으면 우리의 FirstProject의 폴더 구조는 아래와 같은 모양일겁니다.
이제 package명도 정리하고 MVC패턴에 맞는 폴더 구조로 변경 해보겠습니다.

FirstProjectApplication.java 이름 변경

FirstProjectApplication.java > Refactor > Rename

Application으로 변경합니다.

controller package 이동하기

com.gaeyou.firstproject > new > package

com.gaeyou.firstproject.controller 생성

PersonController.java > Refactor > Move


PersonController.java를 이동하고 기존의 controller package는 삭제합니다.

같은 방법으로 위와 같은 package 구조로 만들어 줍니다.

@ComponentScan 경로 수정
@ComponentScan({"controller", "service"})
Application.java 파일에 ComponentScan 어노테이션에 controller와 service 경로를 설정했었습니다.
package경로가 바뀌었기 때문에 인자값을 제거하도록 하겠습니다.
package com.gaeyou.firstproject;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
@Configuration
@EnableAutoConfiguration
@ComponentScan
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
서버를 구동해서 페이지가 뜨는지 확인합니다.

반응형
'Backend > Spring' 카테고리의 다른 글
| [Spring boot] HttpSession 세션 처리 - Interceptor (0) | 2019.10.15 |
|---|---|
| [Spring boot] mybatis SQL 로그 찍기 - log4jdbc (0) | 2019.10.12 |
| [Spring Boot] Spring Boot - My Batis 연동 - Oracle (12) | 2019.09.19 |
| [Eclipse] Debug shell 사용하기 (0) | 2019.08.28 |
| [Spring Boot] lombok 설정하기 - Mac / Windows (0) | 2019.08.24 |
Comments