Spring Boot 2.5 Release Note
https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.5-Release-Notes
schema.sql
과 data.sql
script를 지원하는 메소드가 다시 설계되었습니다.spring.datasource.properties
가 새로운 spring.sql.init
대체되었습니다.schema.sql
and data.sql
Filesspring.sql.init.mode
속성에 대한 값을 always
로 지정해야합니다.spring.sql.init.mode
속성에 대한 값을never
로 지정해야합니다..org.springframework.jdbc.datasource.init.DataSourceInitializer
빈을 정의해야합니다.data.sql
스크립트는 Hibernate가 초기화되기 전에 실행된다.
이로 인해 Flyway, Liquibas의 스크립트 기반 기본 초기화 방안과 일치한다.
만약 data.sql
로 Hibernate로 생성한 스키마에 데이터를 추가하고 싶으면 spring.jpa.defer-datasource-initialization
값을 true
지정하면 된다.
데이터베이스 초기화 기술을 혼합하는 것은 권장되지 않지만, data.sql
을 통해 데이터가 추가되기 전에 schema.sql
스크립트를 사용하여 Hibernate로 생성된 스키마를 기반으로 작성할 수도 있습니다.
JdbcTemplate와 같이 잘 알려진 특정 유형의 Bean은 데이터베이스가 초기화된 후 초기화되도록 정렬됩니다.
DataSource
와 직접적으로 사용하는 Bean이 있는 경우 클래스에 주석을 추가하거나 @Bean으로 등록된 메소드에 @DependsOnDatabase
주석을 추가하면 데이터베이스를 초기화한 후에 빈이 생성됨이 보장됩니다.
현재 스프링에서 spring.flyway.url
또는 spring.liquibase.url
로 정의하고 있엇다면 username
과 password
속성을 추가적으로 제공해야 한다.
스프링부트의 이전 버전에서는 이러한 설정은 spring.datasource
속성에서 파생되었지만 Datasource
Bean을 제공하는 사람들에게는 문제가 있는 것으로 드러났다.
/info
에 대한 actuator endpoint 더 이상 웹에서 기본으로 노출되지 않습니다.
또한 Spring Security가 클래스 경로에 있고 응용 프로그램에 사용자 지정 보안 구성이 없는 경우 엔드포인트에는 기본적으로 인증된 액세스 권한이 필요합니다.
Spring Integration은 이제 자체 구성 대신 사용 가능한 TaskScheduler
를 재사용한다.
자동 구성에 의존하는 일반적인 응용 프로그램 설정에서 Spring Integration은 Pool 크기가 1인 자동 구성된 작업 스케줄러를 사용합니다.
Spring Integration의 기본값인 10개의 스레드를 복원하려면 'spring.task.scheduling.pool.size' 속성을 사용하십시오.
Spring Boot의 웹 및 유효성 검사 시작 프로그램에 포함된 EL 구현이 변경되었습니다.
Tomcat의 구현체(org.apache.tomcat.embed.tomcat-embed-el
)가 Glassfish (org.glassfish:jakrta.el
)참조 구현 대신 사용된다.
이제 기본 오류 보기의 'message' 특성이 표시되지 않으면 비워지지 않고 제거됩니다.
오류 응답 JSON을 구문 분석할 경우 누락된 항목을 처리해야 할 수 있습니다.
메시지를 포함하려는 경우에도 'server.error.include-message' 속성을 사용할 수 있습니다.
We now register a logging shutdown hook by default for jar based applications to ensure that logging resources are released when the JVM exits.
If your application is deployed as a war then the shutdown hook is not registered since the servlet container usually handles logging concerns.
Most applications will want the shutdown hook. However, if your application has complex context hierarchies, then you may need to disable it.
You can use the logging.register-shutdown-hook
property to do that.
The Spring Boot Gradle Plugin no longer automatically disables the standard Gradle jar
and war
tasks.
Instead we now apply a classifier
to those tasks.
If you prefer to disable those tasks, the reference documentation includes updated examples.
Spring Boot no longer provides default values for spring.data.cassandra.request.throttler
properties.
If you rely on max-queue-size
, max-concurrent-requests
, max-requests-per-second
or drain-interval
you should set values that make sense for your application.
DefaultConfiguration
To streamline the customization of jOOQ's DefaultConfiguration
, a bean that implements DefaultConfigurationCustomizer
can now be defined. This customiser callback should be used in favour of defining one or more *Provider
beans, the support for which has now been deprecated.
The default version of Groovy has been upgraded to 3.x. If you are using Groovy and also using Spock, you should also upgrade to the latest Groovy 3.0-compatible release of Spock 2.0. Alternatively, use the groovy.version
to downgrade back to Groovy 2.5.
Projects built with Gradle now require Gradle 6.8 or later.
The default version of Hibernate Validate has been upgraded to 6.2.x. Hibernate Validator 6.2 changes how the expression language is used to interpolate constraint messages.
Please seethis blog post from the Hibernate Validator team for further details.
Reflecting the Spring Boot release compatibility policy, code deprecated in Spring Boot 2.3 has been removed in Spring Boot 2.5.
Code deprecated in Spring Boot 2.4 remains in place, and is scheduled for removal in Spring Boot 2.6.
TIP: Check the configuration changelog for a complete overview of the changes in configuration.
It's now possible to specify a prefix for system environment variables so that you can run multiple different Spring Boot applications in the same environment.
Use SpringApplication.setEnvironmentPrefix(...)
to set the prefix that you want to use when binding properties.
For example, the following will add a myapp
prefix:
[source.java]
SpringApplication application = new SpringApplication(MyApp.class);
application.setEnvironmentPrefix("myapp");
application.run(args);
All properties will now expect a prefixed version.
For example, to change the server port you can set MYAPP_SERVER_PORT
.
All four embedded web containers now support HTTP/2 over TCP (h2c) without any manual customization. To enable h2c, set server.http2.enabled
is true
and leave server.ssl.enabled
set to false
(its default value).
As with the existing h2 support, depending on the embedded web server being used, the use of h2c may require additional dependencies. See the reference documentation for details.
A new generic mechanism is now available if you write code that initializes a DataSource.
This mechanism is also now used internally to setup correct bean dependencies for Flyway, Liquibase and Script based initialization.
Most developers won't need to directly make use of the new mechanism.
However, if you are developing a third-party starter for a data access library, you may want to provide a DependsOnDataSourceInitializationDetector
.
See the updated reference documentation for details.
Support for script-based initialization of an SQL database accessed via R2DBC has been added.
By default, scripts on the classpath named schema.sql
and data.sql
will be applied to the database automatically.
The initialization can be customized using the spring.sql.init.*
configuration properties. Please
see the reference documentation for further details.
If you define a custom DataSource for use with Liquibase we now configure it using a SimpleDriverDataSource
.
We previously used a pooling datasource which was unnecessary and inefficient for database initialization.
The Spring Boot Maven and Gradle plugins now allow you to create layered WARs for use with Docker images.
Layered WARs work in a similar way to the Layered JAR support that was provided in earlier versions of Spring Boot.
Check out the Gradle and Maven reference documentation for more details.
The Maven and Gradle plugins both now support the use of custom Buildpacks.
You can set the buildpacks
property to point at directories, tar.gz files, specific builder references or Docker images.
See the updated Gradle and Maven reference documentation for more details.
The Maven and Gradle plugins now both support volume bindings that can be passed to the buildpack builder.
These allow you to bind local paths or volumes for the buildpack to use.
See the updated Gradle and Maven reference documentation for more details.
Both the Maven and Gradle plugin can now package executable war files into Docker images.
The existing mvn spring-boot:image
or ./gradlew bootBuildImage
commands should be used if you want to create a Docker image for your war.
The /actuator/prometheus
actuator endpoint can now provide both standard Prometheus as well as OpenMetrics responses.
The response returned will depend on the accept header that is provided with the HTTP request.
Actuator will now generate Micrometer metrics for Spring Data repositories.
By default, metrics are named spring.data.repository.invocations
.
To learn more, please see the
relevant section of the reference documentation.
Aligning its capabilities with those of Spring MVC, @Timed
can now be used to manually enable timing of requests handled by WebFlux controllers and functional handlers.
To use manual timing, set management.metrics.web.server.request.autotime.enabled
to false
.
When using Actuator, metrics for Mongo's connection pool and commands sent by the client are now generated automatically.
To learn more about MongoDB metrics, please see the relevant section of the reference documentation.
A /quartz
endpoint has been added to Actuator.
It provides detailed information about Quartz jobs and triggers.
Please see {actuator-api-docs}#quartz[the relevant section of the Actuator's API documentation] for further details.
GET
requests to actuator/startup
The actuator's startup
endpoint now supports GET
requests.
Unlike a POST
request, a GET
request to the endpoint does not drain the event buffer and events will continue to be held in memory.
Actuator's health endpoint now shows the health of the targets of an AbstractRoutingDataSource
.
Each target DataSource
is named using its routing key.
As before, to ignore routing data sources in the health endpoint, set management.health.db.ignore-routing-data-sources
to true
.
This release provides support and is tested against Java 16.
Spring Boot 2.5 remains compatible with Java 8.
The Spring Boot Gradle plugin supports and is tested against Gradle 7.0.x.
Spring Boot 2.5 can now use Jetty 10 as an embedded web server.
As Jetty 10 requires Java 11, our default Jetty version will remain as 9.
To upgrade to Jetty 10, use the jetty.version
property to override the version.
You should also exclude org.eclipse.jetty.websocket:websocket-server
and org.eclipse.jetty.websocket:javax-websocket-server-impl
from spring-boot-starter-jetty
as they are Jetty 9-specific.
-- 생략 --
Apart from the changes listed above, there have also been lots of minor tweaks and improvements including:
management.endpoints.web.cors.allowed-origin-patterns
can now be used to configure the allowed origin patterns for Actuator endpointsHttpSessionIdListener
beans are now automatically registered with the servlet contextObjectMapper
by defaultSniffer
is now auto-configured when its elasticsearch-rest-client-sniffer
module is on the classpathspring.data.cassandra.controlconnection.timeout
can now be used to configure the timeout of Cassandra's control connectionspring.kafka.listener.only-log-record-metadata
can now be used to configure what's logged when retries are being attemptedjdbc:phoenix
JDBC URLs/actuator
discovery page can now be disabled using the management.endpoints.web.discovery.enabled
property./actuator/configprops
and actuator/env
endpoints now have additional-keys-to-sanitize
properties that can be used to sanitize keys.EndpointObjectNameFactory
if you want to customize the name of JMX actuator endpoints.DataSourceBuilder.derivedFrom(...)
method has been added that allows you to build a new DataSource
that's derived from an existing one.RSAPublicKey
and RSAPrivateKey
.ConnectionFactory
used by Spring AMQP can now be customized using a ConnectionFactoryCustomizer
bean.spring.datasource.embedded-database-connection
configuration property. It can be set to any of the values of EmbeddedDatabaseConnection
, including none
to disable embedded database auto-configured entirely.CloudPlatform
can now automatically detect Azure App Service.server.tomcat.keep-alive-timeout
can be used to configure how long Tomcat will wait for another request before closing a keep-alive connection.server.tomcat.max-keep-alive-requests
can be used to control the maximum number of requests that can be made on a keep-alive connection before it is closed.spring.webflux.session.cookie.same-site
can be used to configure WebFlux's SameSite cookie policy. It is lax by default.ApplicationEnvironment
class has been introduced which should improve a small performance boost.spring.netty.leak-detection
property.org.springframework.boot.actuate.endpoint.http
안에 ActuatorMediaType
과 ApiVersion
설정들은 org.springframework.boot.actuate.endpoint
안에 것들과 동일하다.
jOOQ의 *Provider
콜백 인터페이스나 Settings
기능을 지원하는 Beans에 대한 지원은 deprecate 되었습니다, 대신 'DefaultConfigurationCustomizer'를 사용해야 합니다.
org.springframework.boot.autoconfigure.data.jpa
의 EntityManagerFactoryDependsOnPostProcessor
는 org.springframework.boot.orm.jpa
로 이전되었다.