파란하늘의 지식창고
Published 2021. 5. 26. 07:52
Spring Boot 2.5 Release Notes Study/Java
반응형

전체 Release Notes 목록은 이 곳에서 확인할 수 있습니다.

https://luvstudy.tistory.com/tag/Release%20Notes


Spring Boot 2.5 Release Notes

spring-projects/spring-boot

 

spring-projects/spring-boot

Spring Boot. Contribute to spring-projects/spring-boot development by creating an account on GitHub.

github.com

Upgrading from Spring Boot 2.4

SQL Script DataSource Initialization

지원 schema.sqldata.sql script에 사용되는 근본적인 method가 Spring Boot 2.5에서 재설계되었습니다.
DataSource initialization과 관련된 spring.datasource.* properties가 deprecated 되고 R2DBC를 통해 액세스 하는 SQL database를 초기화하는 데 사용될 수 있는 새로운 spring.sql.init.* properties를 제공합니다.

새로운 script 기반 SQL database initialization은 schema (DDL) 및 data (DML) 변경에 대해 별도의 자격 증명 사용을 지원하지 않습니다.
이를 통해 복잡성을 줄이고 Flyway 및 Liquibase에 맞게 기능을 조정할 수 있습니다.
schema 및 data initialization에 별도의 자격 증명이 필요한 경우 org.springframework.jdbc.datasource.init.DataSourceInitializer bean을 정의하세요.

Hibernate and data.sql

기본적으로 data.sql script는 Hibernate가 초기화되기 전에 실행됩니다.
이것은 basic script 기반 initialization의 동작을 Flyway 및 Liquibase의 동작과 일치시킵니다.
data.sql 을 사용하여 Hibernate에 의해 생성된 schema를 populate 하려면 spring.jpa.defer-datasource-initializationtrue로 설정하세요.
database initialization을 섞어 쓰는 것을 권장하지 않지만, data.sql을 통해 populated 되기 전에 schema.sql script를 사용하여 Hibernate 생성 schema를 기반으로 build 할 수 있습니다.

Flyway and Liquibase JDBC URLs

만약 spring.flyway.url 또는 spring.liquibase.url을 정의한 경우 추가적인 usernamepassword properties를 제공해야 할 수 있습니다.
이전 버전의 Spring Boot에서 이러한 설정은 spring.datasource properties에서 파생되었지만 자체 DataSource bean을 제공한 사람들에게 문제가 되는 것으로 밝혀졌습니다.

Spring Data Solr

2021.0.0의 Spring Data에서 제거된 후, 이번 release에서는 Spring Data Solr에 대한 auto-configuration이 제거되었습니다.

Secure Info Endpoint

/info actuator endpoint는 더 이상 default로 웹을 통해 노출되지 않습니다.
또한 Spring Security가 classpath에 있는 경우 endpoint는 default로 인증된 access를 요구합니다.

이러한 새 default를 변경하려면 exposingsecuring actuator endpoint에 대한 document를 참조하세요.

Default Expression Language (EL) Implementation

Spring Boot의 web 및 validation starger에 포함된 EL implementation이 변경되었습니다.
이제 Glassfish의 implementataion(org.glassfish:jakrta.el) 참조 대신 Tomcat의 implementation (org.apache.tomcat.embed.tomcat-embed-el)이 사용됩니다.

Messages in the Default Error View

default error view의 message attribute가 표시되지 않을 때 비워지지 않고(blanked) 제거(removed)됩니다.
error response JSON을 parse 하는 경우 누락된 항목을 처리해야 할 수도 있습니다.

만약 포함되기를 원하는 경우 server.error.include-message property를 통해 계속 사용할 수 있습니다.

Logging Shutdown Hooks

이제 JVM이 종료될 때 logging resource가 해제되도록 jar 기반 application에 대해 default로 logging shutdown hook를 등록합니다.
application이 war로 배포된 경우 servlet container가 일반적으로 logging 문제를 처리하므로 shutdown hook가 등록되지 않습니다.

대부분의 경우 application은 shutdown hook를 원합니다.
그러나 application에 복잡한 context hierarchy가 있는 경우 비활성화해야 할 수 있습니다.
이를 위해 logging.register-shutdown-hook property를 사용할 수 있습니다.

Gradle Default jar and war Tasks

Spring Boot Gradle plugin은 더 이상 standard Gradle jarwar task를 자동으로 비활성화하지 않습니다.
대신 이러한 task에 classifier를 적용합니다.

이러한 task를 비활성화하려면 참조 문서의 includes updated examples를 참조하세요.

Cassandra Throttling Properties

Spring Boot는 더 이상 spring.data.cassandra.request.throttler properties에 대한 default value를 제공하지 않습니다.
만약 max-queue-size, max-concurrent-requests, max-requests-per-second 또는 drain-interval 을 사용하는 경우 application에 용도에 맞는 value를 설정해야 합니다.

Customizing jOOQ's DefaultConfiguration

jOOQ의 DefaultConfugration customization을 간소화하기 위해 DefaultConfigurationCustomizer 를 구현하는 bean을 정의할 수 있습니다.

이 customizer callback은 하나 이상의 *Provider bean을 정의하는 데 사용해야 하며 이 bean은 현재 deprecated 되었습니다.

Groovy 3

Groovy의 default version이 3.x로 업그레이드되었습니다. Groovy를 사용하고 Spock도 사용하는 경우 Spock 2.0의 최신 Groovy 3.0 호환 release로 업그레이드해야 합니다.
또는 groovy.version 을 사용하여 Groovy 2.5로 다시 다운그레이드 합니다.

Minimum Requirements Changes

이제 Gradle로 빌드된 project에는 Gradle 6.8 이상이 필요합니다.

Deprecations from Spring Boot 2.3 and 2.4

Spring Boot release 호환성 정책을 반영하여 Spring Boot 2.3에서 사용되지 않는 코드가 Spring Boot 2.5에서 제거되었습니다.
Spring Boot 2.4에서 deprecated 된 코드는 그대로 유지되며 Spring Boot 2.6에서 제거될 예정입니다.

New and Notewarthy

configuration 변경 사항에 대한 전체 overview는 configuration changelog를 확인하세요.

Environment Variable Prefixes

이제 동일한 환경에서 여러 다른 Spring Boot application을 실행할 수 있도록 system environment variable에 대한 prefix를 지정할 수 있습니다.
properties를 binding 할 때 사용할 prefix를 설정하려면 SpringApplication.setEnvironmentPrefix(...) 를 사용하세요.

예를 들어 다음은 myapp prefix를 추가합니다:

SpringApplication application = new SpringApplication(MyApp.class);
application.setEnvironmentPrefix("myapp");
application.run(args);

이제 모든 properties에 prefix가 붙은 version이 필요합니다.
예를 들어 server port를 변경하려면 MYAPP_SERVER_PORT 를 설정할 수 있습니다.

HTTP/2 over TCP (h2c)

이제 4개의 embedded web container 모두 어떤 manual customization 없이 HTTP/2 over TCP (h2c)를 지원합니다.
h2c를 사용하려면 server.http2.enabledtrue 로, server.ssl.enabledfalse 로 (defaut value 임) 설정하세요.

Generic DataSource Initialization

이제 DataBase를 초기화하는 코드를 작성하면 새로운 generic mechanism을 사용할 수 있습니다.
이 mechanism은 이제 내부적으로 Flyway, Liquibase 및 Script 기반 initialization에 대한 올바른 bean dependency를 설정하는 데 사용됩니다.

대부분의 개발자는 새로운 mechanism을 직접 사용할 필요가 없습니다.
그러나 data access library에 대한 third-party starter를 개발하는 경우 DependsOnDataSourceInitializationDetector 를 제공할 수 있습니다.

DataBase Initialization with R2DBC

R2DBC를 통해 액세스 되는 SQL database의 script 기반 initialization에 대한 지원이 추가되었습니다.
기본적으로 schema.sqldata.sql 로 명명된 classpath의 script는 database에 자동으로 적용됩니다.
spring.sql.init.* configuration properties를 사용하여 initialization을 customize 할 수 있습니다.
자세한 내용은 reference documentation을 참조하세요.

Liquibase DataSource

Liquibase와 함께 사용할 custom DataSource를 정의하면 SimpleDriverDataSource 를 사용하여 구성합니다.
이전에는 database initialization에 불필요하고 비효율적인 polling datasource를 사용했습니다.

Layered WARs

이제 Spring Boot Maven 및 Gradle plugin을 사용하여 Docker image와 함께 사용할 layered WAR를 만들 수 있습니다.
layered WAR는 이전 버전의 Spring에서 제공되었던 layered JAR 지원과 유사한 방식으로 작동합니다.
자세한 내용은 GradleMaven 문서를 확인하세요.

Docker Image Building Support

Custom Buildpacks

이제 Maven 및 Gradle plugin 모두 custom Buildpack 사용을 지원합니다.
buildpacks property를 설정하여 directory, tar.gz file, 특정 builder 참조 또는 Docker image를 지정할 수 있습니다.

자세한 내용은 업데이트된 GradleMaven 문서를 참조하세요.

Bindings

Maven 및 Gradle plugin은 이제 buildpack builder에 전달할 수 있는 volume binding을 둘 다 지원합니다.
이를 통해 buildpack이 사용할 local path 또는 volume을 binding 할 수 있습니다.

자세한 내용은 업데이트된 GradleMaven 문서를 참조하세요.

War support

이제 Maven 및 Gradle plugin 모두 executable war file을 Docker image로 packaging 할 수 있습니다.
war를 위한 Docker image를 생성하려면 기존 mvn spring-boot:image 또는 ./gradlew bootBuildImage command를 사용해야 합니다.

OpenMetrics for Prometheus

/actuator/prometheus actuator endpoint는 이제 모두 standard Prometheus 뿐만 아니라 OpenMetrics response를 제공할 수 있습니다.
반환되는 response는 HTTP request와 함께 제공되는 accept header에 따라 다릅니다.

Metrics for Spring Data Repositories

Actuator는 이제 Spring Data repository에 대한 Micrometer metric을 생성합니다.
default metric의 이름은 spring.data.repository.invocation 입니다.
자세한 내용은 reference documentation의 관련 section을 참조하세요.

@Timed Metrics with WebFlux

Spring MVC의 기능과 동일하게, @Timed 는 이제 WebFlux controller와 functional handler가 처리하는 request의 timing을 수동으로 활성화하는 데 사용될 수 있습니다.
수동으로 timing을 사용하려면 management.metrics.web.server.request.autotime.enabledtrue로 설정하세요.

MongoDB Metrics

Actuator를 사용할 때 mongo의 connection pool 및 client에서 보낸 command에 대한 metric이 이제 자동으로 생성됩니다.
MongoDB metric에 대해 자세히 알아보려면 reference documentation의 관련 section을 참조하세요.

Actuator Endpoint for Quartz

/quartz endpoint가 Actuator에 추가되었습니다.
Quartz job 및 trigger에 대한 자세한 정보를 제공합니다.
자세한 내용은 reference documentation의 관련 section을 참조하세요.

GET requests to actuator/startup

이제 actuator의 startup endpoint가 GET request를 지원합니다.
POST request와 달리 endpoint에 대한 GET request는 event buffer를 배출하지 않으며 event는 memory에 계속 보관됩니다.

Abstract Routing DataSource Health

Actuator의 health endpoint는 이제 AbstractRoutingDataSource 의 target health를 보여줍니다.
각 대상 DataSource 는 routing key를 사용하여 이름이 지정됩니다.
이전과 마찬가지로 health endpoint에서 routing data source를 무시하려면 management.health.db.ignore-routing-data-sourcestrue 로 설정합니다.

Java 16 Support

이 release는 지원을 제공하며 Java 16에 대해 테스트되었습니다.
Spring Boot 2.5는 Java 8과 호환됩니다.

Gradle 7 Support

Spring Boot Gradle plugin은 Gradle 7.0.x를 지원하고 테스트되었습니다.

Jetty 10 Support

Spring Boot 2.5는 이제 Jetty 10을 embedded web server로 사용할 수 있습니다.
Jetty 10에는 Java 11이 필요하므로 기본 Jetty version은 9로 유지됩니다.

Jetty 10으로 업그레이드하려면 dependency를 직접 선언하거나 pom.xml의 jetty.version proerty를 사용하세요.

Documentation Updates

프로젝트에서 publish 한 HTML documentation에는 업데이트된 look-and-feel 및 몇 가지 새로운 기능이 있습니다.
이제 sample 위로 마우스를 가져간 다음 "copy" icon을 클릭하여 code snippet을 clipboard에 쉽게 복사할 수 있습니다.
또한 이제 많은 sample에 필요에 따라 표시하거나 숨길 수 있는 전체 import 문이 포함되어 있습니다.

이제 각 문서 상단에 "dark theme" switcher가 있습니다.

Miscellaneous

위에 나열된 변경 사항 외에도 다음과 같은 많은 사소한 조정 및 개선 사항이 있습니다.

  • 이제 Actuator endpoint에 대해 allowed origin pattern을 구성하는데 management.endpoint.web.cors.allowed-origin-patterns 를 사용할 수 있습니다. (#24608)
  • HttpSessionIdListener bean은 이제 servlet context에 자동으로 등록됩니다. (#24879)
  • Couchbase는 이제 ObjectMapper 를 기본적으로 자동 구성합니다. (#24616)
  • ElasticSearch의 elasticsearch-rest-client-sniffer 모듈이 classpath에 있을 때 Sniffer 를 자동 구성합니다. (#24174)
  • 이제 Cassandra의 control connection의 timeout을 구성하는데 spring.data.cassandra.controlconnection.time 을 사용할 수 있습니다. (#24189)
  • 이제 retry를 시도할 때 log를 구성하는데 spring.kafka.listener.only-log-record-metadata 를 사용할 수 있습니다. (#24582)
  • Apache Phoenix 지원, jdbc:phoenix JDBC URL 자동감지 (#24114)
  • Rabbit의 key store 및 trust store algorithms에 대한 configuration properties (#24076)
  • /actuator discovery page는 이제 management.endpoints.web.discovery.enabled property를 사용하여 비활성화할 수 있습니다.
  • /actuator/configpropsactuator/env endpoint는 이제 키를 삭제하는 데 사용할 수 있는 additional-keys-to-santize property가 있습니다.
  • 이제 JMX actuator endpoint의 이름을 customize 하려는 경우 EndpointObjectNameFactory 를 사용할 수 있습니다.
  • 기존 datasouce를 기반으로 새로운 datasource를 구축할 수 있는 새로운 DataSourceBuilder.derivedFrom(...) method가 추가되었습니다.
  • Spring Security가 classpath에 있을 때 configuration properties는 이제 RSAPublicKeyRSAPrivateKey 에 binding 될 수 있습니다.
  • Spring AMQP에서 사용하는 RabbitMQ ConnectionFactory 는 이제 ConnectionFactoryCustomizer bean을 사용하여 customize 할 수 있습니다.
  • 이제 새 spring.datasource.embedded-database-connection configuration property를 사용하여 자동 구성된 embedded database를 제어할 수 있습니다.
    none을 포함하여 EmbeddedDatabaseConnection 의 값을 설정하여 완전히 자동 구성할 수 없도록 설정할 수 있습니다.
  • CloudPlatform은 이제 Azure App Service를 자동으로 검색할 수 있습니다.
  • keep-alive connection을 닫기 전에 Tomcat이 다른 request를 기다리는 시간을 구성하는데 server.tomcat.keep-alive-timeout 을 사용할 수 있습니다.
  • keep-alive connection이 닫히기 전에 최대 request 수를 제어하는데 server.tomcat.max-keep-alive-requests 를 사용할 수 있습니다.
  • WebFlux의 Samesite cookie 정책을 구성하는데 spring.webflux.session.cookie.same-site 를 사용할 수 있습니다.
  • Apache HttpClient 5는 이제 WebClient와 함께 사용할 수 있도록 자동 구성됩니다.
  • 약간의 성능 향상을 위한 새로운 ApplicationEnvironment class가 도입되었습니다.
  • 이제 spring.netty.leak-detection property를 사용하여 Netty memory를 구성할 수 있습니다.

Dependency Upgrades

Spring Boot 2.5는 여러 Spring project의 새 version으로 이동합니다:

수많은 third-party dependencies도 업데이트되었으며 그중 더 주목할만한 사항은 다음과 같습니다.

  • Kotlin 1.5
  • Groovy 3.0
  • Flyway 7.7
  • Liquibase 4.2
  • Jackson 2.12
  • Kafka 2.7
  • Cassandra Driver 4.10
  • Embedded Mongo 3.0
  • Hibernate Validator 6.2
  • Jersey 2.33
  • Mockito 3.7
  • MongoDB 4.2
  • JUnit Jupiter 5.7
  • Elasticsearch 7.12

Notable Deprecations in Spring Boot 2.5

Spring Boot 2.5에서 다음과 같은 주목할만한 deprecation이 이루어졌습니다.

  • org.springframework.boot.actuate.endpoint.httpActuatorMediaTypeApiVersionorg.springframework.boot.actuate.endpoint 에 동등한 항목으로 변경됩니다.
  • jOOQ의 *Provider callback interface 또는 Settings 를 구현하는 bean에 대한 지원이 deprecated 되었습니다.
    대신 DefaultConfigurationCustomizer 를 사용해야 합니다.
  • org.springframework.boot.autoconfigure.data.jpaEntityManagerFactoryDependsOnPostProcessororg.springframework.boot.autoconfigure.orm.jpa 로 이동되었습니다.
반응형
profile

파란하늘의 지식창고

@Bluesky_

내용이 유익했다면 광고 배너를 클릭 해주세요