-
Notifications
You must be signed in to change notification settings - Fork 40.7k
Spring Boot 2.5.0 M3 Release Notes
If you currently define a spring.flyway.url
or spring.liquibase.url
you may need to provide additional username
and password
properties.
In earlier versions of Spring Boot, these settings were derived from spring.datasource
properties but this turned out to be problematic for people that provided their own DataSource beans.
We now register a logging shutdown hook by default for jar based applications to ensure that release 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.
By default, data.sql
scripts are now run before Hibernate is initialized.
This aligns the behaviour of basic script-based initialization with that of Flyway and Liquibase.
If you want to use data.sql
to populate a schema created by Hibernate, set spring.jpa.defer-datasource-initialization
to true
.
While mixing database initialization technologies is not recommended, this will also allow you to use a schema.sql
script to build upon a Hibernate-created schema before it’s populated via data.sql
.
Classes, methods and properties that were deprecated in Spring Boot 2.3 have been removed in this release. Please ensure that you aren’t calling deprecated methods before upgrading.
Tip
|
Check the configuration changelog for a complete overview of the changes in configuration. |
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.
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.
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:
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
.
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.
The HTML documentation published by the project has an updated look-and-feel and some new features. You can now easily copy snippets of code to the clipboard by hovering over the sample and clicking the "copy" icon. In addition, many of the samples now include full import statements that can be shown or hidden as required.
We also now have a "dark theme" switcher at the top of each document.
Spring Boot 2.5 moves to new versions of several Spring projects:
-
Spring Integration 5.5.0-M3
-
Spring Kafka 2.7.0-RC1
Numerous third-party dependencies have also been updated, some of the more noteworthy of which are the following:
-
Kotlin 1.4.31
-
Flyway 7.7.0
Apart from the changes listed above, there have also been lots of minor tweaks and improvements including:
-
The
/actuator/configprops
andactuator/env
endpoints now haveadditional-keys-to-sanitize
properties that can be used to sanitize keys. -
You can now use a
EndpointObjectNameFactory
if you want to customize the name of JMX actuator endpoints. -
A new
DataSourceBuilder.derivedFrom(…)
method has been added that allows you to build a newDataSource
that’s derived from an existing one.