https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-4.0-Migration-Guide
41 revision 기준으로 작성됨
이 문서는 애플리케이션을 Spring Boot 4.0으로 migration 하는 데 도움이 되도록 작성되었습니다.
Before You Start
최신 3.5.x 버전으로 업그레이드
업그레이드를 시작하기 전에 프로젝트를 가능한 최신 3.5.x 버전으로 먼저 올리십시오.
이렇게 하면 해당 라인의 최신 의존성들을 기준으로 빌드됩니다.
업그레이드 전에 Spring Boot 4.0에서 제거될 예정인 deprecated API(메서드/클래스/프로퍼티)가 사용되고 있지 않은지 반드시 검토하세요.
의존성 검토
Spring Boot 4로의 이동은 여러 의존성의 업그레이드를 수반하므로 프로젝트에서 수정이 필요할 수 있습니다.
3.5.x 의존성 관리과 4.0.x 의존성 관리를 비교하여 영향 범위를 평가하세요.
Spring Boot에서 관리되지 않는 종속성(예: Spring Cloud )을 사용할 수도 있습니다.
프로젝트에서 해당 종속성에 대한 명확한 버전을 정의하므로 업그레이드하기 전에 호환되는 버전을 확인하세요.
시스템 요구사항 검토
Spring Boot 4.0은 Java 17 이상을 요구합니다. 최신 LTS 버전의 Java 사용을 권장합니다.
Kotlin으로 개발하는 경우 Kotlin v2.2 이상을 사용해야 합니다.
GraalVM의 native-image를 사용하는 경우 v25 이상이 필요합니다.
Spring Boot 4는 Jakarta EE 11을 기반으로 하며 Servlet 6.1 이상을 전제로 합니다.
직접 의존성을 관리하는 경우 Spring Framework 7.x를 사용하도록 업데이트하세요.
Spring Boot 3.x에서의 사용 중단(deprecation) 항목 검토
Spring Boot 3.x에서 deprecated로 표시된 class, method, properties는 이 release에서 제거되었습니다.
업그레이드 전에 deprecated된 API를 사용하고 있지 않은지 확인하세요.
Upgrade to Spring Boot 4
프로젝트 상태와 의존성을 검토한 후 Spring Boot 4.0의 최신 maintenance release로 업그레이드하세요.
이 release에서 제거된 기능
다음 항목들은 이 release에서 제거되었으며 더 이상 사용할 수 없습니다.
Undertow
Undertow는 아직 Servlet 6.1을 완전히 지원하지 않으므로 Undertow 지원(Undertow starter 및 내장 서버로 사용)이 제거되었습니다.
Servlet 6.1을 준수하지 않는 컨테이너에 Spring Boot 4.0 애플리케이션을 배포하는 것은 권장하지 않습니다.
Pulsar Reactive
Spring Pulsar에서 reactor 지원이 제거된 결정에 따라 Spring Boot는 더 이상 reactive Pulsar 클라이언트를 관리하지 않습니다.
Spring Pulsar Reactive에 대한 자동 구성도 제거되었습니다.
Embedded Executable Uber Jar Launch Scripts
embedded launch script (fully executable jar 생성용)에 대한 지원이 제거되었습니다.
이 기능은 주로 유닉스 계열 운영체제에 특화되어 있었고 여러 제약이 있었는데, 특히 효율적인 배포에 대한 권장 사항 과 충돌하는 경우가 많았습니다.
비슷한 기능이 필요하면 Gradle의 application plugin 등의 대안을 검토하세요.
여전히 Spring Boot 빌드 플러그인을 사용해 uber jar를 생성하고 java -jar로 실행할 수 있습니다.
Spring Session Hazelcast
Spring Session Hazelcast의 관리는 Hazelcast 팀 으로 이관되었으며, 이에 따라 Spring Boot 자체에서 제공하던 직접적인 지원이 제거되었습니다.
Spring Session MongoDB
Spring Session MongoDB의 관리는 MongoDB 팀 으로 이관되었으며, 이에 따라 Spring Boot 자체에 제공하던 직접적인 지원이 제거되었습니다.
Spock Integration
Spock이 아직 Groovy 5를 지원하지 않으므로 Spring Boot의 Spock 통합은 제거되었습니다.
Module Dependencies
Spring Boot 4.0은 새로운 모듈화 설계 를 도입하여 큰 JAR 대신 목적 별로 작은 모듈들을 제공합니다.
애플리케이션이 Spring Boot의 starter POM을 사용한다면 대부분의 의존성은 자동으로 맞춰져 이전과 같이 동작할 것입니다.
다만 테스트 인프라 또한 모듈화 되었으므로 테스트 관련 의존성은 특히 주의해서 검토해야 합니다.starter POM을 사용하지 않는 경우에는 의존성 수정을 해야 할 수도 있습니다.
Starters
이번 release에서는 starter 사용을 두 가지 방식으로 정리했습니다.
- 대부분의 기술에 대해 전용
starter가 제공됩니다. - 각
starter에는 테스트 용 companionstarter가 있습니다.
테스트 의존성 구성을 검토하는 것은 중요합니다.
다음 표는 특정 기술을 지원하는데 사용해야 하는 "starter" POM을 보여줍니다.
| Technology | Main Dependency | Test Dependency |
|---|---|---|
| Core Starters | ||
| AspectJ | spring-boot-starter-aspectj |
spring-boot-starter-aspectj-test |
| Cloud Foundry Support | spring-boot-starter-cloudfoundry |
spring-boot-starter-cloudfoundry-test |
| Jakarta Validation | spring-boot-starter-validation |
spring-boot-starter-validation-test |
| Kotlin Serialization | spring-boot-starter-kotlin-serialization |
spring-boot-starter-kotlin-serialization-test |
| Reactor | spring-boot-starter-reactor |
spring-boot-starter-reactor-test |
| Web Server Starters | ||
| Jetty | spring-boot-starter-jetty |
none |
| Reactor Netty | spring-boot-starter-reactor-netty |
none |
| Tomcat | spring-boot-starter-tomcat |
none |
| Web Client Starters | ||
Spring’s Imperative RestClient and RestTemplate |
spring-boot-starter-restclient |
spring-boot-starter-restclient-test |
Spring’s Reactive WebClient |
spring-boot-starter-webclient |
spring-boot-starter-webclient-test |
| Web Starters | ||
| Jersey | spring-boot-starter-jersey |
spring-boot-starter-jersey-test |
| Spring GraphQL | spring-boot-starter-graphql |
spring-boot-starter-graphql-test |
| Spring HATEOAS | spring-boot-starter-hateoas |
spring-boot-starter-hateoas-test |
| Spring Session Data Redis | spring-boot-starter-session-data-redis |
spring-boot-starter-session-data-redis-test |
| Spring Session JDBC | spring-boot-starter-session-jdbc |
spring-boot-starter-session-jdbc-test |
| Spring Web MVC | spring-boot-starter-webmvc |
spring-boot-starter-webmvc-test |
| Spring WebFlux | spring-boot-starter-webflux |
spring-boot-starter-webflux-test |
| Spring Webservices | spring-boot-starter-webservices |
spring-boot-starter-webservices-test |
| Database Starters | ||
| Cassandra | spring-boot-starter-cassandra |
spring-boot-starter-cassandra-test |
| Couchbase | spring-boot-starter-couchbase |
spring-boot-starter-couchbase-test |
| Elasticsearch | spring-boot-starter-elasticsearch |
spring-boot-starter-elasticsearch-test |
| Flyway | spring-boot-starter-flyway |
spring-boot-starter-flyway-test |
| JDBC | spring-boot-starter-jdbc |
spring-boot-starter-jdbc-test |
| jOOQ | spring-boot-starter-jooq |
spring-boot-starter-jooq-test |
| Liquibase | spring-boot-starter-liquibase |
spring-boot-starter-liquibase-test |
| LDAP | spring-boot-starter-ldap |
spring-boot-starter-ldap-test |
| MongoDB | spring-boot-starter-mongodb |
spring-boot-starter-mongodb-test |
| Neo4J | spring-boot-starter-neo4j |
spring-boot-starter-neo4j-test |
| R2DBC | spring-boot-starter-r2dbc |
spring-boot-starter-r2dbc-test |
| Spring Data Starters | ||
| Spring Data Cassandra | spring-boot-starter-data-cassandra or spring-boot-starter-data-cassandra-reactive |
spring-boot-starter-data-cassandra-test or spring-boot-starter-data-cassandra-reactive-test |
| Spring Data Couchbase | spring-boot-starter-data-couchbase or spring-boot-starter-data-couchbase-reactive |
spring-boot-starter-data-couchbase-test or spring-boot-starter-data-couchbase-reactive-test |
| Spring Data Elasticsearch | spring-boot-starter-data-elasticsearch |
spring-boot-starter-data-elasticsearch-test |
| Spring Data JDBC | spring-boot-starter-data-jdbc |
spring-boot-starter-data-jdbc-test |
| Spring Data JPA (using Hibernate) | spring-boot-starter-data-jpa |
spring-boot-starter-data-jpa-test |
| Spring Data LDAP | spring-boot-starter-data-ldap |
spring-boot-starter-data-ldap-test |
| Spring Data MongoDB | spring-boot-starter-data-mongodb or spring-boot-starter-data-mongodb-reactive |
spring-boot-starter-data-mongodb-test or spring-boot-starter-data-mongodb-reactive-test |
| Spring Data Neo4J | spring-boot-starter-data-neo4j |
spring-boot-starter-data-neo4j-test |
| Spring Data R2DBC | spring-boot-starter-data-r2dbc |
spring-boot-starter-data-r2dbc-test |
| Spring Data Redis | spring-boot-starter-data-redis or spring-boot-starter-data-redis-reactive |
spring-boot-starter-data-redis-test or spring-boot-starter-data-redis-reactive-test |
| Spring Data REST | spring-boot-starter-data-rest |
spring-boot-starter-data-rest-test |
| IO Starters | ||
| Hazelcast | spring-boot-starter-hazelcast |
spring-boot-starter-hazelcast-test |
spring-boot-starter-mail |
spring-boot-starter-mail-test |
|
| Quartz | spring-boot-starter-quartz |
spring-boot-starter-quartz-test |
| SendGrid | spring-boot-starter-sendgrid |
spring-boot-starter-sendgrid-test |
| Spring Caching Support | spring-boot-starter-cache |
spring-boot-starter-cache-test |
| Spring Batch (with JDBC) | spring-boot-starter-batch-jdbc |
spring-boot-starter-batch-jdbc-test |
| Spring Batch (without JDBC) | spring-boot-starter-batch |
spring-boot-starter-batch-test |
| JSON Starters | ||
| GSON | spring-boot-starter-gson |
spring-boot-starter-gson-test |
| Jackson | spring-boot-starter-jackson |
spring-boot-starter-jackson-test |
| JSONB | spring-boot-starter-jsonb |
spring-boot-starter-jsonb-test |
| Messaging Starters | ||
| ActiveMQ | spring-boot-starter-activemq |
spring-boot-starter-activemq-test |
| Artemis | spring-boot-starter-artemis |
spring-boot-starter-artemis-test |
| JMS | spring-boot-starter-jms |
spring-boot-starter-jms-test |
| RSocket | spring-boot-starter-rsocket |
spring-boot-starter-rsocket-test |
| Spring AMQP | spring-boot-starter-amqp |
spring-boot-starter-amqp-test |
| Spring Integration | spring-boot-starter-integration |
spring-boot-starter-integration-test |
| Spring for Apache Kafka | spring-boot-starter-kafka |
spring-boot-starter-kafka-test |
| Spring for Apache Pulsar | spring-boot-starter-pulsar |
spring-boot-starter-pulsar-test |
| Websockets | spring-boot-starter-websocket |
spring-boot-starter-websocket-test |
| Security Starters | ||
| Spring Security | spring-boot-starter-security |
spring-boot-starter-security-test |
| Spring Security OAuth Authorization Server | spring-boot-starter-security-oauth2-authorization-server |
spring-boot-starter-security-oauth2-authorization-server-test |
| Spring Security OAuth Client | spring-boot-starter-security-oauth2-client |
spring-boot-starter-security-oauth2-client-test |
| Spring Security OAuth Resource Server | spring-boot-starter-security-oauth2-resource-server |
spring-boot-starter-security-oauth2-resource-server-test |
| Spring Security SAML | spring-boot-starter-security-saml2 |
spring-boot-starter-security-saml2-test |
| Templating Starters | ||
| Freemarker | spring-boot-starter-freemarker |
spring-boot-starter-freemarker-test |
| Groovy Templates | spring-boot-starter-groovy-templates |
spring-boot-starter-groovy-templates-test |
| Mustache | spring-boot-starter-mustache |
spring-boot-starter-mustache-test |
| Thymeleaf | spring-boot-starter-thymeleaf |
spring-boot-starter-thymeleaf-test |
| Production-Ready Starters | ||
| Actuator | spring-boot-starter-actuator |
spring-boot-starter-actuator-test |
| Micrometer Metrics | spring-boot-starter-micrometer-metrics |
spring-boot-starter-micrometer-metrics-test |
| OpenTelemetry | spring-boot-starter-opentelemetry |
spring-boot-starter-opentelemetry-test |
| Zipkin | spring-boot-starter-zipkin |
spring-boot-starter-zipkin-test |
| #### Modules |
"starter" POM을 사용하지 않으려면 대신 module dependency를 직접 선언할 수 있습니다.
| Technology | Main Dependency | Test Dependency |
|---|---|---|
| Core Modules | ||
| Cloud Foundry Support | spring-boot-cloudfoundry |
none |
| Jakarta Validation | spring-boot-validation |
none |
| Kotlin Serialization | spring-boot-kotlin-serialization |
none |
| Reactor | spring-boot-reactor |
none |
| Web Server Modules | ||
| Jetty | spring-boot-jetty |
none |
| Reactor Netty | spring-boot-reactor-netty |
none |
| Tomcat | spring-boot-tomcat |
none |
| Web Client Modules | ||
Spring’s Imperative RestClient and RestTemplate |
spring-boot-restclient |
spring-boot-restclient-test |
Spring’s Reactive WebClient |
spring-boot-webclient |
spring-boot-webclient-test |
| Web Modules | ||
| Jersey | spring-boot-jersey |
none |
| Spring GraphQL | spring-boot-graphql |
spring-boot-graphql-test |
| Spring HATEOAS | spring-boot-hateoas |
none |
| Spring Session Data Redis | spring-boot-session-data-redis |
none |
| Spring Session JDBC | spring-boot-session-jdbc |
none |
| Spring Web MVC | spring-boot-webmvc |
spring-boot-webmvc-test |
| Spring WebFlux | spring-boot-webflux |
spring-boot-webflux-test |
| Spring Webservices | spring-boot-webservices |
spring-boot-webservices-test |
| Database Modules | ||
| Cassandra | spring-boot-cassandra |
none |
| Couchbase | spring-boot-couchbase |
none |
| Elasticsearch | spring-boot-elasticsearch |
none |
| Flyway | spring-boot-flyway |
none |
| JDBC | spring-boot-jdbc |
spring-boot-jdbc-test |
| jOOQ | spring-boot-jooq |
spring-boot-jooq-test |
| Liquibase | spring-boot-liquibase |
none |
| LDAP | spring-boot-ldap |
none |
| MongoDB | spring-boot-mongodb |
none |
| Neo4J | spring-boot-neo4j |
none |
| R2DBC | spring-boot-r2dbc |
none |
| Spring Data Modules | ||
| Spring Data Cassandra | spring-boot-data-cassandra |
spring-boot-data-cassandra-test |
| Spring Data Couchbase | spring-boot-data-couchbase |
spring-boot-data-couchbase-test |
| Spring Data Elasticsearch | spring-boot-data-elasticsearch |
spring-boot-data-elasticsearch-test |
| Spring Data JDBC | spring-boot-data-jdbc |
spring-boot-data-jdbc-test |
| Spring Data JPA (using Hibernate) | spring-boot-data-jpa |
spring-boot-data-jpa-test |
| Spring Data LDAP | spring-boot-data-ldap |
spring-boot-data-ldap-test |
| Spring Data MongoDB | spring-boot-data-mongodb |
spring-boot-data-mongodb-test |
| Spring Data Neo4J | spring-boot-data-neo4j |
spring-boot-data-neo4j-test |
| Spring Data R2DBC | spring-boot-data-r2dbc |
spring-boot-data-r2dbc-test |
| Spring Data Redis | spring-boot-data-redis |
spring-boot-data-redis-test |
| Spring Data REST | spring-boot-data-rest |
none |
| IO Modules | ||
| Hazelcast | spring-boot-hazelcast |
none |
spring-boot-mail |
none | |
| Quartz | spring-boot-quartz |
none |
| SendGrid | spring-boot-sendgrid |
none |
| Spring Caching Support | spring-boot-cache |
spring-boot-cache-test |
| Spring Batch (with JDBC) | spring-boot-batch-jdbc |
none |
| Spring Batch (without JDBC) | spring-boot-batch |
none |
| JSON Modules | ||
| GSON | spring-boot-gson |
none |
| Jackson | spring-boot-jackson |
none |
| JSONB | spring-boot-jsonb |
none |
| Messaging Modules | ||
| ActiveMQ | spring-boot-activemq |
none |
| Artemis | spring-boot-artemis |
none |
| JMS | spring-boot-jms |
none |
| RSocket | spring-boot-rsocket |
spring-boot-rsocket-test |
| Spring AMQP | spring-boot-amqp |
none |
| Spring Integration | spring-boot-integration |
none |
| Spring for Apache Kafka | spring-boot-kafka |
none |
| Spring for Apache Pulsar | spring-boot-pulsar |
none |
| Websockets | spring-boot-websocket |
none |
| Security Modules | ||
| Spring Security | spring-boot-security |
spring-boot-security-test |
| Spring Security OAuth Authorization Server | spring-boot-security-oauth2-authorization-server |
none |
| Spring Security OAuth Client | spring-boot-security-oauth2-client |
none |
| Spring Security OAuth Resource Server | spring-boot-security-oauth2-resource-server |
none |
| Spring Security SAML | spring-boot-security-saml2 |
none |
| Templating Modules | ||
| Freemarker | spring-boot-freemarker |
none |
| Groovy Templates | spring-boot-groovy-templates |
none |
| Mustache | spring-boot-mustache |
none |
| Thymeleaf | spring-boot-thymeleaf |
none |
| Production-Ready Modules | ||
| OpenTelemetry | spring-boot-opentelemetry |
none |
| Zipkin | spring-boot-zipkin |
none |
Classic Starters
기존 application을 upgrade 하고 빠르게 실행하고 싶다면 "Classic Starter POM"을 사용할 수 있습니다.
Classic starter는 모든 모듈을 포함하지만 전이적(transitive) 의존성은 제외합니다.
이 구성은 이전 세대 Spring Boot와 유사하게 모든 auto-configuration 클래스를 사용 가능하게 합니다.
Classic starter를 사용하려면 빌드 구성을 적절히 변경하세요.
| Previous Starter | Classic Equivalent |
|---|---|
spring-boot-starter |
spring-boot-starter-classic |
spring-boot-starter-test |
spring-boot-starter-test-classic |
NOTE: 결국에는 classic starter를 사용하지 않고 application을 migration 하는 것이 좋습니다.
Deprecated Starters
여러 starter POM의 이름이 해당 module과 도 잘 일치하도록 변경되었습니다.
이전 starter는 그대로 유지되지만, 더 이상 지원되지 않으므로 향후 release에서 제거될 예정입니다.
다음과 같이 POM을 업데이트 해야 합니다.
| Deprecated Starter | Replacement |
|---|---|
spring-boot-starter-oauth2-authorization-server |
spring-boot-starter-security-oauth2-authorization-server |
spring-boot-starter-oauth2-client |
spring-boot-starter-security-oauth2-client |
spring-boot-starter-oauth2-resource-server |
spring-boot-starter-security-oauth2-resource-server |
spring-boot-starter-web |
spring-boot-starter-webmvc |
spring-boot-starter-web-services |
spring-boot-starter-webservices |
Package Organization
모듈화는 project의 package 구조에도 영향을 미칩니다.
각 module은 이제 전용 org.springframework.boot.<module> 로 시작합니다.
module의 범위에 따라 API, auto-configuration, actuator 관련 지원 등을 포함할 수 있습니다.
Considerations For Projects Building Their Own Starters
모듈화 작업으로 인해 동일한 artifact 내에서 Spring Boot 3와 Spring Boot 4를 모두 지원하는 것은 강력히 권장하지 않습니다.
Upgrading Core Features
JSpecify Nullability annotations
Spring Boot 4.0은 JSpecify nullability annotation을 도입했습니다.
빌드에서 null checker를 사용하거나 Kotlin을 사용하는 경우 새로 적용되는 nullable/non-nullable type으로 인해 컴파일 오류가 발생할 수 있으니 주의하세요.
Logback Default Charset
Logback의 기본 문자셋이 Log4j2의 동작과 일치하도록 정리되었습니다.
로그 파일의 기본 문자셋은 UTF-8입니다.
콘솔 로그는 Console#charset()을 사용 가능하면 해당 값을 사용하고, 그렇지 않으면 UTF-8을 사용합니다.
BootstrapRegistry and EnvironmentPostProcessor package changes
BootstrapRegistry와 관련 클래스가 org.springframework.boot에서 org.springframework.boot.bootstrap로 이동했습니다.EnvironmentPostProcessor 인터페이스는 org.springframework.boot.env에서 org.springframework.boot로 이동했습니다.
Spring Boot와 깊이 통합된 코드가 있다면 코드와 spring.factories 파일을 업데이트해야 할 수 있습니다.
NOTE: deprecated된 EnvironmentPostProcessor 형태는 4.0에서 아직 사용 가능하지만 향후 제거될 예정입니다.
Property Mapper API Changes
PropertyMapper는 이제 source value가 null일 때 기본적으로 adapter나 predicate 메서드를 호출하지 않습니다.
이로 인해 alwaysApplyingNotNull() method는 제거되었습니다.
null 값에 대해서도 매핑하려면 새로운 always() method를 사용하세요.
예를 들면:
map.from(source::method).to(destination::method);
첫 예제는 source.method()가 null을 반환하면 destination.method(...)를 호출하지 않습니다.
map.from(source::method).always().to(destination::method);
두 번째 예제는 source.method()가 null을 반환하면 destination.method(null) 을 호출합니다.
참고: Spring Boot 자체가 이 API 변경에 어떻게 대응했는지 보려면 커밋 예시(예: 239f384ac0 )를 확인하세요.
DevTools Live Reload Support
DevTools의 Live Reload 기능은 기본적으로 비활성화되었습니다.
Live Reload를 사용하려면 spring.devtools.livereload.enabled=true로 설정하세요.
Upgrading Dependencies and Build Plugins
Optional Dependencies in Maven
Maven에서 optional dependencies는 더 이상 uber jar에 포함되지 않습니다.
필요하면 빌드 설정에서 <includeOptional>true</includeOptional>를 사용하세요.
AOP Starter POM
spring-boot-starter-aop는 spring-boot-starter-aspectj로 이름이 변경되었습니다.
application에 명시적으로 추가해 두었다면 실제로 필요한지 검토한 후 교체하세요.
application이 AspectJ를 사용하지 않는 경우(일반적으로 org.aspectj.lang.annotation package의 annotation) starter는 전혀 필요하지 않을 수 있습니다.
Dependency Management for Spring Retry
포트폴리오가 Spring Retry에서 Spring Framework 의 core feature로 이동함에 따라 Spring Retry에 대한 의존성 관리는 제거되었습니다.
여전히 Spring Retry를 사용한다면 이제 명시적 버전 지정이 필요합니다.
Spring Retry의 사용을 Spring Framework로 옮기는 것을 고려해 보세요.
Dependency Management for Spring Authorization Server
Spring Authorization Server는 이제 Spring Security의 일부 로 통합되었습니다.
명시적 의존성 관리는 Spring Security가 제공하는 방식으로 대체되었습니다.
결과적으로 spring-authorization-server.version property로 버전을 재정의할 수 없습니다.
필요하면 앞으로 spring-security.version을 사용하세요.
Classic Uber-Jar Loader Support
클래식 uber-jar loader는 이 release에서 제거되었습니다.
빌드 파일에서 관련 loader 구현 설정을 제거하세요.
Maven의 경우 아래 설정을 제거하고:
<loaderImplementation>CLASSIC</loaderImplementation>
Gradle의 경우는 다음과 같습니다.
loaderImplementation = org.springframework.boot.loader.tools.LoaderImplementation.CLASSIC
Cyclone DX Gradle Plugin
CycloneDX Gradle plugin의 최소 지원 버전은 이제 3.0.0입니다.
Upgrading Jackson
Spring Boot는 기본 JSON 라이브러리로 Jackson 3를 사용합니다.
Jackson 3는 com.fasterxml.jackson이 tools.jackson로 바뀌면서 group ID와 package name이 변경되었습니다.
다만 jackson-annotations 모듈은 계속해서 com.fasterxml.jackson.core 그룹 ID와 com.fasterxml.jackson.annotation package를 사용합니다.
자세한 변경 사항은 Jackson 위키 를 참고하세요.
Jackson 2를 필요로 하는 라이브러리가 있는 경우 Jackson 2에 대한 의존성 관리는 유지되며,
필요하면 Spring Boot의 Jackson 3 자동 구성과 함께 Jackson 2 ObjectMapper를 사용할 수 있습니다.
몇몇 class 이름이 Jackson 3과의 일관성을 위해 변경되었습니다 (예: JsonObjectSerializer -> ObjectValueSerializer).
JsonObjectSerializertoObjectValueSerializer.JsonValueDeserializertoObjectValueDeserializer.Jackson2ObjectMapperBuilderCustomizertoJsonMapperBuilderCustomizer.
@JsonComponent, @JsonMixin 및 관련 지원 class는 Jackson에만 국한된 것이 아니고 반드시 JSON에만 국한되지 않는다는 점을 명확히 하기 위해 이름이 변경되었습니다.@JsonComponent 은 이제 @JacksonComponent 로, @JsonMixin 은 이제 @JacksonMixin 으로 변경되었습니다.
지원 class의 이름도 같은 방식으로 변경되어 Json 이 Jackson 으로 변경되었습니다.
JSON 관련 property(spring.jackson.read.* , spring.jackson.write.* )는 각각 spring.jackson.json.read , spring.jackson.json.write 아래로 이동했습니다.
Jackson 2 Compatibility
Jackson 2에서 Jackson 3으로 migration을 돕기 위해 spring.jackson.use-jackson2-defaults 속성이 추가되었습니다.
이 값을 true로 설정하면 자동 구성된 JsonMapper가 Spring Boot 3.x의 Jackson 2 기본값과 최대한 일치하도록 구성됩니다.
가능하면 Jackson 3으로 전환하는 것을 권장합니다. 다만 당장 불가능한 경우 Spring Boot 4.0은 임시 방편으로 spring-boot-jackson2 모듈을 제공합니다.
이 모듈은 deprecated 상태로 제공되며 향후 release에서 제거될 예정입니다.
Jackson 2 모듈을 사용하려면 Maven POM에 다음 dependency를 추가하면 됩니다:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-jackson2</artifactId>
</dependency>
Gradle의 경우:
implementation("org.springframework.boot:spring-boot-jackson2")
Jackson 2 관련 property는 spring.jackson2 아래에 제공됩니다.
이는 Spring Boot 3.5에서 사용하던 spring.jackson property와 기능적으로 동일합니다.
자세한 내용은 참조 문서 를 확인하세요,
Upgrading Actuator and Production-Ready Features
Removed Support for javax.annotations.NonNull and org.springframework.lang.Nullable
Actuator의 endpoint parameter에서는 더 이상 org.springframework.lang.Nullable를 사용하여 parameter가 선택적임을 표시할 수 없습니다.
이 annotation을 사용 중이라면 org.jspecify.annotations.Nullable로 migration하세요.
Liveness and Readiness Probes
liveness 및 readiness probes는 기본적으로 활성화됩니다.
따라서 health endpoint는 기본적으로 liveness와 readiness 그룹을 노출합니다.
필요하지 않다면 management.endpoint.health.probes.enabled로 비활성화할 수 있습니다.
Upgrading Web Features
Fonts Added to Common Static Locations
PathRequest#toStaticResources를 사용하는 경우 이 release에서는 /fonts/ 위치가 static resource 경로에 추가된다는 점을 유의하세요.
기본 설정으로는 이전과 동일한 보안 설정이 적용됩니다.
해당 위치를 포함하지 않으려면 다른 위치와 마찬가지로 제외할 수 있습니다.
pathRequest.toStaticResources().atCommonLocations().excluding(StaticResourceLocation.FONTS);
Spring Session
Spring Session Data Redis 관련 property의 접두사가 spring.session.redis에서 spring.session.data.redis로,spring.session.mongodb는 spring.session.data.mongodb로 변경되었습니다.
HttpMessageConverters Deprecation
이 release에서는 Spring Boot의 HttpMessageConverters 타입이 deprecated로 표시되었습니다.
이는 Spring Framework가 기존 스택에서 converter configuration을 개선 했기 때문입니다.HttpMessageConverters는 client와 server converter를 혼합하는 등 몇가지 문제가 있었습니다.
application에서 custom org.springframework.boot.http.converter.autoconfigure.HttpMessageConverters bean을 선언하고 있다면 여전히 동작하지만 타입 자체는 deprecated입니다.
대신 ClientHttpMessageConvertersCustomizer 및 ServerHttpMessageConvertersCustomizer를 사용해 converter를 유연하게 customize 하세요.
Jersey
Spring Boot 4.0은 Jersey 4.0을 지원하지만 Jersey 4.0은 아직 Jackson 3을 지원하지 않습니다.
Jersey에서 JSON 처리를 하려면 (기존 spring-boot-jackson 대신 또는 spring-boot-jackson 과 함께) spring-boot-jackson2 모듈을 사용하세요 .
Upgrading Data Features
Elasticsearch Client
Elasticsearch 변경에 따라 low-level RestClient 용 auto-configuration이 제거되고 새로운 Rest5Client 용 auto-configuration으로 대체되었습니다.
만약 RestClientBuilderCustomizer를 사용해 client를 customize 했다면 이제 Rest5ClientBuilderCustomizer를 사용해야 합니다.
Elasticsearch client code는 co.elastic.clients:elasticsearch-java 모듈로 통합되었고 sniffer 지원도 포함됩니다.
따라서 org.elasticsearch.client:elasticsearch-rest-client 및 org.elasticsearch.client:elasticsearch-rest-client-sniffer 모듈은 더 이상 필요하지 않으며 Spring Boot의 해당 의존성 관리는 제거되었습니다.
higher-level ElasticsearchClient 와 Spring Data Elasticsearch에서 제공하는 ReactiveElasticsearchClient 에 대한 지원은 유지됩니다.
새로운 low-level client를 사용하도록 업데이트 되었습니다.
Persistence Modules
일반적인 persistence 관련 code와 property를 위한 spring-boot-persistence 모듈이 추가되었습니다.@EntityScan을 사용하는 경우 import를 org.springframework.boot.persistence.autoconfigure.EntityScan로 조정하세요.
spring.dao.exceptiontranslation.enabled property는 더 이상 지원되지 않으니 spring.persistence.exceptiontranslation.enabled를 사용하세요.
MongoDB
MongoDB 구성 관련 일부 property 이름이 변경되어 Spring Data MongoDB가 필요한지 여부를 반영합니다.
이전 spring.data.mongodb.* 접두사를 가진 많은 property가 spring.mongodb.*로 이동했습니다.
다음은 변경된 대표적인 property 목록입니다:
spring.mongodb.additional-hostsspring.mongodb.authentication-databasespring.mongodb.databasespring.mongodb.hostspring.mongodb.passwordspring.mongodb.portspring.mongodb.protocolspring.mongodb.replica-set-namespring.mongodb.representation.uuidspring.mongodb.ssl.bundlespring.mongodb.ssl.enabledspring.mongodb.urispring.mongodb.username
management 관련 property 이름도 mongo 대신 mongodb를 사용하도록 변경되었습니다:
management.health.mongodb.enabledmanagement.metrics.mongodb.command.enabledmanagement.metrics.mongodb.connectionpool.enabled
다음 property 들은 여전히 Spring Data MongoDB가 필요한 property로 남아 있습니다:
spring.data.mongodb.auto-index-creationspring.data.mongodb.field-naming-strategyspring.data.mongodb.gridfs.bucketspring.data.mongodb.gridfs.databasespring.data.mongodb.repositories.type
MongoDB UUID and BigDecimal Representations
Spring Data MongoDB는 더 이상 UUID 및 BigInteger/BigDecimal의 기본 표현을 제공하지 않습니다.
이는 드라이버 권고와 일치하며, 업그레이드로 인한 표현 방식 변경을 피하기 위한 조치입니다.
명시적 구성이 필요하며, 표현 방식은 각각 spring.mongodb.representation.uuid 및 spring.data.mongodb.representation.big-decimal property로 설정할 수 있습니다.
Hibernate Dependency Management
Hibernate 관련 의존성 관리는 재배치(relocation)를 고려해 조정되었습니다.
hibernate-jpamodelgen은hibernate-processor로 대체되었습니다.hibernate-proxool및hibernate-vibur는 더 이상 배포되지 않습니다.
Upgrading Messaging Features
Kafka Streams Customization
Spring Boot의 StreamBuilderFactoryBeanCustomizer는 제거되었고 대신 Spring Kafka의 StreamsBuilderFactoryBeanConfigurer를 사용해야 합니다.
새 configurer는 Ordered를 구현하며 기본 값은 0입니다.
Spring Kafka Retry Features
Spring Kafka의 retry 기능은 Spring Retry에서 Spring Framework 로 이동했습니다.
그 결과 spring.kafka.retry.topic.backoff.random은 제거되고 spring.kafka.retry.topic.backoff.jitter로 대체되었습니다.
자세한 내용은 참조 문서 를 확인하세요.
Spring AMQP Retry Features
Spring AMQP도 retry 기능을 Spring Retry에서 Spring Framework 로 이전했습니다.
Spring Boot는 RetryTemplate과 message listeners에서 사용되는 retry 기능을 customize하기 위한 hook-point를 제공합니다.
이를 위해 RabbitTemplateRetrySettingsCustomizer와 RabbitListenerRetrySettingsCustomizer 두 개의 전용 customizer가 도입되었습니다.
기존에 RabbitRetryTemplateCustomizer를 사용했다면 해당 interface들 중 하나로 migration하세요.
Upgrading Testing Features
Mockito Captor and Mock Annotations
MockitoTestExecutionListener(Spring Boot 3.4에서 deprecated)는 이 release에서 제거되었습니다.
이로 인해 @Mock 또는 @Captor annotation이 예상대로 동작하지 않을 수 있습니다.
이 경우 Mockito의 MockitoExtension을 사용하세요.
Using MockMVC and @SpringBootTest
@SpringBootTest annotation을 사용해도 더 이상 MockMVC 지원이 제공되지 않습니다.
test에서 MockMVC를 사용하려면 test class에 @AutoConfigureMockMvc를 추가하세요.
또한 HtmlUnit 관련 설정은 이제 htmlUnit attribute로 이동했습니다.
예: Spring Boot 3.5에서 @AutoConfigureMockMvc(webClientEnabled=false, webDriverEnabled=false)를 사용했다면
4.0에서는 @AutoConfigureMockMvc(htmlUnit = @HtmlUnit(webClient = false, webDriver = false))를 사용합니다.
Using WebClient or TestRestTemplate and @SpringBootTest
@SpringBootTest는 더 이상 WebClient나 TestRestTemplate bean을 자동으로 제공하지 않습니다.WebTestClient를 사용하려면 test class에 @AutoConfigureWebTestClient를 추가하고,TestRestTemplate을 사용하려면 @AutoConfigureTestRestTemplate을 추가하세요.
또한 TestRestTemplate 대신 새 RestTestClient class를 사용하는 것을 고려해 보세요.
이를 위해 @AutoConfigureRestTestClient를 test class에 추가할 수 있습니다.
TestRestTemplate Compilation Failures
테스트에서 TestRestTemplate 관련 컴파일 오류가 발생하면 테스트 범위 의존성으로 org.springframework.boot:spring-boot-resttestclient를 추가하세요.
해당 class의 package 경로는 org.springframework.boot.resttestclient.TestRestTemplate로 업데이트해야 합니다.
@PropertyMapping Annotation
@PropertyMapping annotation은 org.springframework.boot.test.autoconfigure.properties package에서 org.springframework.boot.test.context로 이동했습니다.
또한 skip attribute는 이제 org.springframework.boot.test.autoconfigure.properties.Skip 대신 org.springframework.boot.test.context.PropertyMapping.Skip 을 사용합니다.
'Study > Java' 카테고리의 다른 글
| Spring Boot 4.0 Release Notes (0) | 2025.11.25 |
|---|---|
| JDK 25 New Features (0) | 2025.10.09 |
| Spring Boot version Mappings 확인하기 (0) | 2025.09.11 |
| Spring Boot 4.0 Road to GA introduction (0) | 2025.09.11 |
| [troubleshooting] STS (Eclipse) github copilot plugin 설치 오류 (0) | 2025.08.28 |
| [troubleshooting] STS (Eclipse) lombok record builder annotation 사용 시 오류 (1) | 2025.08.15 |
| Spring Boot 3.5 Release Notes (1) | 2025.05.30 |
| [troubleshooting] eclipse Marketplace plugin 설치 불가 문제 (0) | 2025.05.08 |
| Eclipse(STS)에서 PlantUML을 사용하여 class diagram 보기 (0) | 2025.04.11 |
| Playwright 사용해 보기 (0) | 2025.03.29 |