[์ผ] Spring Boot 2.x -> Spring Boot 3.x ๋ง์ด๊ทธ๋ ์ด์ ์ฌ์
Spring Boot 3.0 Migration Guide
Spring Boot helps you to create Spring-powered, production-grade applications and services with absolute minimum fuss. - spring-projects/spring-boot
github.com
- Spring Boot 3.x ์ ๋์ด์ Java8์ ์ง์ํ์ง ์๋๋ค
- 2.7.x ๋ก ์ ๊ทธ๋ ์ด๋
- ์คํ๋ง ๋ถํธ 2.7.x : https://docs.spring.io/spring-boot/docs/2.7.x/reference/html/dependency-versions.html#appendix.dependency-versions
Dependency Versions
docs.spring.io
- ์คํ๋ง ๋ถํธ 3.0.x : https://docs.spring.io/spring-boot/docs/3.0.x/reference/html/dependency-versions.html#appendix.dependency-versions
Dependency Versions
docs.spring.io
์ํ๋ฆฌํฐ, ํด๋ผ์ฐ๋, ๋ฐฐ์น
- Spring Security 6.0 ์ฌ์ฉ (Spring Boot 3.0)
Spring Security 5.8 (Spring Boot 2.7) ๋ก ์ ๊ทธ๋ ์ด๋ ํ ํ์ Spring Security 6.0์ผ๋ก ๋ณ๊ฒฝํ๊ธฐ
https://docs.spring.io/spring-security/reference/6.0/migration/index.html
Migrating to 6.0 :: Spring Security
Now that you are updated, you need to change your javax imports to jakarta imports.
docs.spring.io
- ์๋ธ๋ฆฟ ์ ํ๋ฆฌ์ผ์ด์ ์์ Spring Secuirt 6.0์ ๋ชจ๋ ๋์คํจ์น ์ ํ์ ๊ถํ ๋ถ์ฌ๋ฅผ ์ ์ฉํ๋ค.
์ด์ ๋ง์ถฐ Spring Boot๋ ๋ชจ๋ ๋์คํจ์น ์ ํ์ ๋ํด Spring Security ํํฐ๊ฐ ํธ์ถ๋๋๋ก ๊ตฌ์ฑํ๋ค.
๋์คํจ์น ์ ํ์ spring.security.filter.dispatcher-types ์์ฑ์ ์ฌ์ฉํ์ฌ ์ค์ ํ ์ ์๋ค.
- Spring Batch 5.0 ์ฌ์ฉ
https://github.com/spring-projects/spring-batch/wiki/Spring-Batch-5.0-Migration-Guide
Spring Batch 5.0 Migration Guide
Spring Batch is a framework for writing batch applications using Java and Spring - spring-projects/spring-batch
github.com
๋ ์ด์ @EnableBatchProcessing ํ์์์
Job๊ณผ Step์ ๋ง๋ค ๋, JobRepository, PlatformTransactionManager ํ๋ผ๋ฏธํฐ๊ฐ ํ์ํจ
JobBuilderFactory์ StepBuilderFactory๊ฐ ์ง์์ด ์ค๋จ๋์๊ณ , JobBuilder์ StepBuilder๋ฅผ ์ฌ์ฉํด์ผ ํจ
- Spring Cloud Bom ์ ๋ฐ์ดํธ
- application.yml ํน์ application.properties ์์
- Spring Cloud Sleuth๋ฅผ Micrometer Tracing ์ผ๋ก ์ด๊ด
(4) Flyway : 9.22.3
(5) Mockito : 5 ์ฌ์ฉ
(6) springdoc-openapi : ๋ถํธ3์ ์ง์ํ๊ธฐ ์ํ ์ํฐํฉํธID ๋ก ๋ณ๊ฒฝ
- ์คํ๋ง ๋ถํธ 3.0 ๋ฒ์ : Spring Boot 3.5.4
- Java 17์ด์ : Java21
- ์คํ๋ง ์ํ๋ฆฌํฐ 6.0 : Spring Security 6.0
- ์คํ๋ง ๋ถํธ 2.x @Deprecated ์ ๊ฑฐ
- ์คํ์ ์ฌ์ฉ๋๋ ํ์ฌ Gradle(8.13)์ด Java 21๊ณผ ํธํ๋์ง ์์ JAR ์์ฑ ๋จ๊ณ์์ ์คํจํ๋ค
- ๋ช ๋ น์ด ๋ฐฉ์ (์์๋ก 19๋ก ๋ด๋ ค์ ์ ๊ทธ๋ ์ด๋ ์คํ ํ ๋ค์ 21๋ก ๋ณ๊ฒฝ)
chmod +x ./gradlew
./gradlew wrapper --gradle-version 8.13
- ์๋ ์ ๊ทธ๋ ์ด๋ ๋ฐฉ์
gradle/wrapper/gradle-wrapper.properties ํ์ผ ์ด์ด์
distributionUrl=https:\://services.gradle.org/distributions/gradle-8.13-bin.zip ๋ก ์์
./gradlew clean build --refresh-dependencies
์ ์ฅ ํ, ์๋ ์คํ
chmod +x ./gradlew
./gradlew --version
- Gradle bootRun์ Modify Run Configuration ์ ํ (-x test ์ถ๊ฐ)
- Jakarata ๋ก ๋ณ๊ฒฝ : find and replace ํจ ใ
(Ultimate๋ฒ์ ๋ง ๋๋ค https://blog.jetbrains.com/idea/2021/06/intellij-idea-eap-6/# )
- ํน์ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ง ์ถ์ ํ๋ ๋ฐฉ๋ฒ
./gradlew dependencyInsight --dependency ์ถ์ ํ๊ณ ์ถ์๋ผ์ด๋ธ๋ฌ๋ฆฌ
1) ์ด๋ค ๋ผ์ด๋ธ๋ฌ๋ฆฌ๊ฐ ์ถ์ ํ๊ณ ์ถ์๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ๋๊ณ ์ค๋์ง
2) ์ด๋ค ๋ฒ์ ๊ฒฝ๋ก๋ก ์ต์ข resolve๋๋์ง
3) ๋ฒ์ ์ถฉ๋์ ์ด๋ค ๋ฒ์ ์ด ์ฐ์ ๋๋์ง
3๊ฐ์ง๋ฅผ ๋ณผ ์ ์๋ค
(1) gradle/wrapper/gradle-wrapper.properties
build.gradle ์ org.springframework.boot ๋ฒ์ ์ 3.5.4 ๋ก ์ฌ๋ ธ๋ค

1) Intellij Migration Tool
- Jakarata ๋ก ๋ณ๊ฒฝ
https://blog.jetbrains.com/idea/2021/06/intellij-idea-eap-6/#
IntelliJ IDEA EAP 6: Automatic Migration From Java EE to Jakarta EE, Shared Indexes for Spring Boot Projects, and More | The Int
IntelliJ IDEA 2021.2 EAP 6 is now available! You can get the new build from our website, through the free Toolbox App, or as a snap (for Ubuntu). In this final EAP before Beta, we have focused on s
blog.jetbrains.com
2) JDK17, Maven ํ๋ก์ ํธ์์ ์ฌ์ฉํด๋ณผ ์ ์์
https://github.com/spring-projects-experimental/spring-boot-migrator
GitHub - spring-projects-experimental/spring-boot-migrator: Spring Boot Migrator (SBM) is a tool for automated code migrations t
Spring Boot Migrator (SBM) is a tool for automated code migrations to upgrade or migrate to Spring Boot - spring-projects-experimental/spring-boot-migrator
github.com
3) https://docs.openrewrite.org/
OpenRewrite by Moderne | Large Scale Automated Refactoring | OpenRewrite Docs
Large-scale automated source code refactoring
docs.openrewrite.org
https://techblog.lycorp.co.jp/ko/how-to-migrate-to-spring-boot-3
์ค์ ! Spring Boot 3 ๋ง์ด๊ทธ๋ ์ด์
๋ค์ด๊ฐ๋ฉฐ์๋ ํ์ธ์. LINE Plus์์ ํ๊ตญ LINE BK ์ฑ๋ ์๋ฒ ๊ฐ๋ฐ ๋ฐ ์ด์ ์ ๋ฌด๋ฅผ ๋งก๊ณ ์๋ ์ด์์ฌ์ ๋๋ค. LINE BK์์๋ ์ง๋ 9์์ LINE BK ๋ณดํ ์ค๊ฐ ์๋น...
techblog.lycorp.co.jp