Spring Boot 가 열 리 는 두 가지 방식 에 대한 상세 한 설명
Spring Boot 를 사용 하 는 것 은 간단 합 니 다.기본 의존 팩 을 먼저 추가 하고 다음 과 같은 두 가지 방법 이 있 습 니 다.
1.spring-boot-starter-parent 프로젝트 계승
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.6.RELEASE</version>
</parent>
2.spring-boot-dependencies 항목 의존 가 져 오기
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>1.5.6.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencyManagement>
Spring Boot 의존 주의 점
1.속성 오 버 레이 는 계승 에 만 유효
This only works if your Maven project inherits (directly or indirectly) from spring-boot-dependencies. If you have added spring-boot-dependencies in your own dependencyManagement section withimportyou have to redefine the artifact yourself instead of overriding the property.
Spring Boot 의존 패키지 에 있 는 구성 요소 의 버 전 은 현재 Spring Boot 와 연결 되 어 있 습 니 다.구성 요소 의 버 전 을 수정 하려 면 다음 과 같은 속성 으로 덮어 쓰 면 됩 니 다.그러나 이 방식 은 계승 에 만 유효 하고 가 져 오 는 방식 이 잘못 되 었 습 니 다.
<properties>
<slf4j.version>1.7.25<slf4j.version>
</properties>
가 져 오 는 방식 이 버 전의 업 그 레이 드 를 실현 하고 위의 효 과 를 얻 으 려 면 업그레이드 할 구성 요 소 를 Spring Boot 전에 의존 할 수 있 습 니 다.
<dependencyManagement>
<dependencies>
<!-- Override Spring Data release train provided by Spring Boot -->
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-releasetrain</artifactId>
<version>Fowler-SR2</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>1.5.6.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
Each Spring Boot release is designed and tested against a specific set of third-party dependencies. Overriding versions may cause compatibility issues.Spring Boot 의 의존 구성 요소 버 전 을 수정 하려 면 호 환 되 지 않 는 문제 가 발생 할 수 있 습 니 다.
2.자원 파일 필터 문제
계승 Spring Boot 를 사용 할 때 Maven resource filter 를 사용 하여 자원 파일 을 걸 러 내 려 면 자원 파일 에 있 는 자리 표시 자 는${}과 Spring Boot 를 구별 하기 위해@...@으로 싸 야 합 니 다.그렇지 않 으 면 유효 하지 않 습 니 다.또한,@...@자리 차지 문 자 는 Yml 파일 편집기 에서 컴 파일 이 잘못 되 었 기 때문에 계승 방식 을 사용 하 는 데 많은 문제 가 있 습 니 다.구 덩이 는 천천히 걸 어야 합 니 다.
이상 이 바로 본 고의 모든 내용 입 니 다.여러분 의 학습 에 도움 이 되 고 저 희 를 많이 응원 해 주 셨 으 면 좋 겠 습 니 다.
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
[MeU] Hashtag 기능 개발➡️ 기존 Tag 테이블에 존재하지 않는 해시태그라면 Tag , tagPostMapping 테이블에 모두 추가 ➡️ 기존에 존재하는 해시태그라면, tagPostMapping 테이블에만 추가 이후에 개발할 태그 기반 ...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.