Spring boot 3.0에서 달라진 점

2024. 1. 14. 21:50·Spring/Version

2022년 11월 스프링부트 3.0 정식 버전이 릴리즈 되었습니다.

이에 따라 기존 2.7 버전에서 변경된 부분을 알아보고자 합니다.

다양한 변경 내용들이 있지만, 제가 사용하고 있는 기능들 위주로 정리를 해 보려합니다.

변경 내역 요약

1. 자바의 최소 버전 변경

2. java ee에서 jakarta ee로 변경

3. log4j2 개선

4. @SpringBootTest의 useMainMethod 속성 추가

자바 최소 버전 변경

스프링 부트 3.0에는 최소 버전으로 Java 17 버전이 필요하게 되었습니다.

Java EE에서 Jakarta EE로 마이그레이션

기존의 Java EE 패키지는 서블릿, jsp, jsf, cdi, jpa, validtaion 등등의 다양한 기능을 제공하고 있었습니다.

Spring을 통해 웹 애플리케이션 서비스개발할 때 미들웨어로써 많이들 사용해 보셨을 것 같습니다.

해당 패키지들이 아래와 같이 변경되었습니다.

참고)  https://www.samsungsds.com/kr/insights/java_jakarta.html

log4j2 개선점

주된 변경 사항입니다.

  • profile-specific configuration

아래의 태그를 사용해서 선택적으로 로그 구성 섹션을 포함하거나 제외할 수 있습니다.

<SpringProfile name="staging">
    <!-- configuration to be enabled when the "staging" profile is active -->
</SpringProfile>

<SpringProfile name="dev | staging">
    <!-- configuration to be enabled when the "dev" or "staging" profiles are active -->
</SpringProfile>

<SpringProfile name="!production">
    <!-- configuration to be enabled when the "production" profile is not active -->
</SpringProfile>
  • profile-specific configuration

아래와 같이 스프링 환경 속성을 조회해올 수 있습니다.

<Properties>
    <Property name="applicationName">${spring:spring.application.name}</property>
</Properties>
  • 시스템 속성 지원
    로그 구성시 시스템 속성을 지원합니다.
    지원하는 시스템속성, 하단 공식 문서참조
    https://logging.apache.org/log4j/2.x/manual/configuration.html#SystemProperties

SpringBootTest에 useMainMethod 속성 추가

아래 코드는 배너를 추가하고, 프로필을 추가하는 예시

public static enum UseMainMethod {
        ALWAYS,
        NEVER,
        WHEN_AVAILABLE;
    }

@SpringBootTest(useMainMethod = UseMainMethod.ALWAYS)

import org.springframework.boot.Banner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class MyApplication {

    public static void main(String[] args) {
        SpringApplication application = new SpringApplication(MyApplication.class);
        application.setBannerMode(Banner.Mode.OFF);
        application.setAdditionalProfiles("myprofile");
        application.run(args);
    }

}


지원 중단된 내용

  • 쿠키의 commnet 속성을 지원하지 않음.
  • ClientHttpRequestFactories를 ClientHttpRequestFactorySupplier로 변경됨.
  • AutoConfigureMetrics @AutoConfigureObservability를 위해 사용되지 않음.

 

마치며


상당히 많은 부분이 변경된 spring boot의 3.0 버전이었다.

우리회사는 모놀리식 서버의 개발 방식을 사용하고 있어, 개선된 내용에 대해 이해하지 못하는 내용이 대다수여서

많이 제거하고 포스팅 하게 되었다.

많이 부족함을 느낀다.

 

참고 문서

https://spring.io/blog/2022/05/24/preparing-for-spring-boot-3-0/

https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.0-Release-Notes

'Spring > Version' 카테고리의 다른 글

Spring Boot 3.2 특징  (0) 2024.01.15
'Spring/Version' 카테고리의 다른 글
  • Spring Boot 3.2 특징
HD9504
HD9504
  • HD9504
    습관
    HD9504
  • 전체
    오늘
    어제
    • 분류 전체보기
      • python
        • 트러블슈팅
        • Numpy
        • pandas
        • Wordbook in python
      • Listen to a lecture
        • school for ai in edwith
      • 용어정리
      • 전공 복습
        • 실험계획법
        • 회귀분석
        • 베이지안
        • 일반화 선형모형
      • 자연어처리
      • 글쓰기 공부
      • 밑바닥부터 시작
      • Java
      • Spring
        • JPA
        • Version
      • Web
        • HTML, CSS
        • Javascript
        • 개념, 이론
      • 하루일과
      • 알고리즘 공부
      • 사색
      • 문제해결
      • Database
        • Redis
      • Computer Science
  • 블로그 메뉴

    • 홈
    • 태그
    • 방명록
  • 링크

  • 공지사항

  • 인기 글

  • 태그

    til
    Java
    spring
    항해99
    99클럽
    REDIS
    디자인패턴
    Decorator
    spring boot
    개발자취업
    코딩테스트준비
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.3
HD9504
Spring boot 3.0에서 달라진 점
상단으로

티스토리툴바