Spring Boot
Spring boot 원리
상국이
2022. 1. 1. 15:36
728x90
Spring boot 구조
메이븐 기본 프로젝트 구조와 동일
- 소스 코드 (src\main\java)
- 소스 리소스 (src\main\resource)
- 테스트 코드 (src\test\java)
- 테스트 리소스 (src\test\resource)
Spring boot 의존성 관리
최상위 parent(spring-boot-dependencies)에 dependency가 정의되어있음
> 호환을 위한 각각의 의존성을 따로 설정해줄 필요가 없음
* parent가 고정되어 변경이 불가능한 경우 dependencyManagement를 사용하여 의존성 설정을 할 수 있음
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-releasetrain</artifactId>
<version>Fowler-SR2</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- dependency를 적용하기 위한 버젼 명시 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.0.3.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
하지만 parent에서 의존성관리 뿐만 아니라 다른 properties, plugins, resource filtering 등도 관리해주기 때문에 따로 설정해주어야 함
* dependency설정할 때 starter에 들어있다면 버젼을 명시해주지 않아도 되지만 버젼을 명시해두는 것이 관리를 위해 좋음
728x90