You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
plugins {
id 'org.springframework.boot' version '3.0.2'//id 'io.spring.dependency-management' version '1.1.0'
id 'java'
}
group ='hello'
version ='0.0.1-SNAPSHOT'
sourceCompatibility ='17'//스프링 부트 외부 라이브러리 버전 변경//ext['tomcat.version']='10.1.4'
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
}
dependencies {
//1. 라이브러리 직접 지정//스프링 웹 MVC
implementation 'org.springframework:spring-webmvc:6.0.4'//내장 톰캣
implementation 'org.apache.tomcat.embed:tomcat-embed-core:10.1.5'//JSON 처리
implementation 'com.fasterxml.jackson.core:jackson-databind:2.14.1'//스프링 부트 관련
implementation 'org.springframework.boot:spring-boot:3.0.2'
implementation 'org.springframework.boot:spring-boot-autoconfigure:3.0.2'//LOG 관련
implementation 'ch.qos.logback:logback-classic:1.4.5'
implementation 'org.apache.logging.log4j:log4j-to-slf4j:2.19.0'
implementation 'org.slf4j:jul-to-slf4j:2.0.6'//YML 관련
implementation 'org.yaml:snakeyaml:1.33'/* //2. 스프링 부트 라이브러리 버전 관리 //스프링 웹, MVC implementation 'org.springframework:spring-webmvc' //내장 톰캣 implementation 'org.apache.tomcat.embed:tomcat-embed-core' //JSON 처리 implementation 'com.fasterxml.jackson.core:jackson-databind' //스프링 부트 관련 implementation 'org.springframework.boot:spring-boot' implementation 'org.springframework.boot:spring-boot-autoconfigure' //LOG 관련 implementation 'ch.qos.logback:logback-classic' implementation 'org.apache.logging.log4j:log4j-to-slf4j' implementation 'org.slf4j:jul-to-slf4j' //YML 관련 implementation 'org.yaml:snakeyaml'*//* //3. 스프링 부트 스타터 implementation 'org.springframework.boot:spring-boot-starter-web'*/
}
tasks.named('test') {
useJUnitPlatform()
}
2️⃣ 스프링 부트 라이브러리 버전 관리
plugins {
id 'org.springframework.boot' version '3.0.2'
id 'io.spring.dependency-management' version '1.1.0'//추가
id 'java'
}
라이브러리를 보면 버전 정보가 모두 제거되었다.
dependencies {
//2. 스프링 부트 라이브러리 버전 관리//스프링 웹, MVC
implementation 'org.springframework:spring-webmvc'//내장 톰캣
implementation 'org.apache.tomcat.embed:tomcat-embed-core'//JSON 처리
implementation 'com.fasterxml.jackson.core:jackson-databind'//스프링 부트 관련
implementation 'org.springframework.boot:spring-boot'
implementation 'org.springframework.boot:spring-boot-autoconfigure'//LOG 관련
implementation 'ch.qos.logback:logback-classic'
implementation 'org.apache.logging.log4j:log4j-to-slf4j'
implementation 'org.slf4j:jul-to-slf4j'//YML 관련
implementation 'org.yaml:snakeyaml'
}
✅ dependency-management 버전관리
io.spring.dependency-management 플러그인을 사용하면 spring-boot-dependencies 에 있는 다음bom 정보를 참고한다. 참고로 spring-boot-dependencies 는 스프링 부트 gradle 플러그인에서 사용하기 때문에 개발자의 눈에 의존관계로 보이지는 않는다.
3️⃣ 스프링 부터 스타터
앞서 보았듯이 웹 프로젝트를 하나 실행하려면 생각보다 수 많은 라이브러리가 필요하다.
스프링 웹 MVC, 내장 톰캣, JSON 처리, 스프링 부트 관련, LOG, YML 등등 다양한 라이브러리가 사용된
다.
개발자 입장에서는 그냥 웹 프로젝트를 하나 시작하고 싶은 것이고, 일반적으로 많이 사용하는 대중적인 라
이브러리들을 포함해서 간단하게 시작하고 싶을 것이다.
스프링 부트는 이런 문제를 해결하기 위해 프로젝트를 시작하는데 필요한 관련 라이브러리를 모아둔 스프링
부트 스타터를 제공한다.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
섹션5. 스프링부트 스타더와 라이브러리 관리
0️⃣ 들어가기 전에…
✅ 라이브러리 관리의 어려움
라이브러리들끼리의 호환성 문제
스프링부트가 제공하는 다양한 기능들
1️⃣ 라이브러리 직접 관리
plugins { id 'org.springframework.boot' version '3.0.2' //id 'io.spring.dependency-management' version '1.1.0' id 'java' } group = 'hello' version = '0.0.1-SNAPSHOT' sourceCompatibility = '17' //스프링 부트 외부 라이브러리 버전 변경 //ext['tomcat.version']='10.1.4' configurations { compileOnly { extendsFrom annotationProcessor } } repositories { mavenCentral() } dependencies { //1. 라이브러리 직접 지정 //스프링 웹 MVC implementation 'org.springframework:spring-webmvc:6.0.4' //내장 톰캣 implementation 'org.apache.tomcat.embed:tomcat-embed-core:10.1.5' //JSON 처리 implementation 'com.fasterxml.jackson.core:jackson-databind:2.14.1' //스프링 부트 관련 implementation 'org.springframework.boot:spring-boot:3.0.2' implementation 'org.springframework.boot:spring-boot-autoconfigure:3.0.2' //LOG 관련 implementation 'ch.qos.logback:logback-classic:1.4.5' implementation 'org.apache.logging.log4j:log4j-to-slf4j:2.19.0' implementation 'org.slf4j:jul-to-slf4j:2.0.6' //YML 관련 implementation 'org.yaml:snakeyaml:1.33' /* //2. 스프링 부트 라이브러리 버전 관리 //스프링 웹, MVC implementation 'org.springframework:spring-webmvc' //내장 톰캣 implementation 'org.apache.tomcat.embed:tomcat-embed-core' //JSON 처리 implementation 'com.fasterxml.jackson.core:jackson-databind' //스프링 부트 관련 implementation 'org.springframework.boot:spring-boot' implementation 'org.springframework.boot:spring-boot-autoconfigure' //LOG 관련 implementation 'ch.qos.logback:logback-classic' implementation 'org.apache.logging.log4j:log4j-to-slf4j' implementation 'org.slf4j:jul-to-slf4j' //YML 관련 implementation 'org.yaml:snakeyaml' */ /* //3. 스프링 부트 스타터 implementation 'org.springframework.boot:spring-boot-starter-web' */ } tasks.named('test') { useJUnitPlatform() }2️⃣ 스프링 부트 라이브러리 버전 관리
plugins { id 'org.springframework.boot' version '3.0.2' id 'io.spring.dependency-management' version '1.1.0' //추가 id 'java' }dependencies { //2. 스프링 부트 라이브러리 버전 관리 //스프링 웹, MVC implementation 'org.springframework:spring-webmvc' //내장 톰캣 implementation 'org.apache.tomcat.embed:tomcat-embed-core' //JSON 처리 implementation 'com.fasterxml.jackson.core:jackson-databind' //스프링 부트 관련 implementation 'org.springframework.boot:spring-boot' implementation 'org.springframework.boot:spring-boot-autoconfigure' //LOG 관련 implementation 'ch.qos.logback:logback-classic' implementation 'org.apache.logging.log4j:log4j-to-slf4j' implementation 'org.slf4j:jul-to-slf4j' //YML 관련 implementation 'org.yaml:snakeyaml' }✅ dependency-management 버전 관리
io.spring.dependency-management플러그인을 사용하면spring-boot-dependencies에 있는 다음bom 정보를 참고한다. 참고로spring-boot-dependencies는 스프링 부트 gradle 플러그인에서 사용하기 때문에 개발자의 눈에 의존관계로 보이지는 않는다.3️⃣ 스프링 부터 스타터
앞서 보았듯이 웹 프로젝트를 하나 실행하려면 생각보다 수 많은 라이브러리가 필요하다.
스프링 웹 MVC, 내장 톰캣, JSON 처리, 스프링 부트 관련, LOG, YML 등등 다양한 라이브러리가 사용된
다.
개발자 입장에서는 그냥 웹 프로젝트를 하나 시작하고 싶은 것이고, 일반적으로 많이 사용하는 대중적인 라
이브러리들을 포함해서 간단하게 시작하고 싶을 것이다.
스프링 부트는 이런 문제를 해결하기 위해 프로젝트를 시작하는데 필요한 관련 라이브러리를 모아둔 스프링
부트 스타터를 제공한다.
스프링 부트 스타터 덕분에 누구나 쉽고 편리하게 프로젝트를 시작할 수 있다.
build.gradle - dependencies 수정
dependencies { //3. 스프링 부트 스타터 implementation 'org.springframework.boot:spring-boot-starter-web' }✅스프링 부트 스타터 - 이름 패턴
✅스프링 부트 스타터 - 자주 사용하는 것 위주
spring-boot-starter: 핵심 스타터, 자동 구성, 로깅, YAMLspring-boot-starter-jdbc: JDBC, HikariCP 커넥션풀spring-boot-starter-data-jpa: 스프링 데이터 JPA, 하이버네이트spring-boot-starter-data-mongodb: 스프링 데이터 몽고spring-boot-starter-data-redis: 스프링 데이터 Redis, Lettuce 클라이언트spring-boot-starter-thymeleaf: 타임리프 뷰와 웹 MVCspring-boot-starter-web: 웹 구축을 위한 스타터, RESTful, 스프링 MVC, 내장 톰캣spring-boot-starter-validation: 자바 빈 검증기(하이버네이트 Validator)spring-boot-starter-batch: 스프링 배치를 위한 스타터✅라이브러리 버전 변경
Beta Was this translation helpful? Give feedback.
All reactions