Skip to content

Spring Boot 3.1.0 RC1 Release Notes

Phillip Webb edited this page Nov 13, 2024 · 1 revision

Spring Boot 3.1.0-RC1 Release Notes

For changes in earlier milestones, please refer to:

Upgrading from Spring Boot 3.0

Hibernate 6.2

Spring Boot 3.1 upgrades to Hibernate 6.2. Please refer to the Hibernate 6.2 migration guide to learn about how this may affect your application.

Jackson 2.15

Spring Boot 3.1 upgrades to Jackson 2.15. Please refer to the Jackson wiki to learn about how this may affect your application.

One notable change in 2.15 is the introduction of processing limits. To tune these constraints, define a Jackson2ObjectMapperBuilderCustomizer similar to the following:

@Bean
Jackson2ObjectMapperBuilderCustomizer customStreamReadConstraints() {
	return (builder) -> builder.postConfigurer((objectMapper) -> objectMapper.getFactory()
		.setStreamReadConstraints(StreamReadConstraints.builder().maxNestingDepth(2000).build()));
}

Mockito 5

Spring Boot 3.1 upgrades to Mockito 5, specifically 5.3. Please refer to the Mockito release notes to learn about the notable changes in the 5.x line of Mockito.

Health Group Membership Validation

The configured membership of a health group is now validated on startup. If a health indicator that does not exist has been included or excluded, startup will fail. This validation can be disabled, restoring the behavior of earlier versions, by setting management.endpoint.health.validate-group-membership to false.

Minimum Requirements Changes

None.

New and Noteworthy

Tip
Check the configuration changelog for a complete overview of the changes in configuration.

Testcontainers

Using Testcontainers at Development Time

Support for using Testcontainers to manage external services at development time has been introduced. Please refer to the updated reference documentation for further details.

Service Connections

The support for creating service connections from TestContainers-managed containers, introduced in M2, has been improved:

  • Service-specific annotations are no longer required and the general-purpose @ServiceConnection annotation can now be used on @Container fields.

  • RedpandaContainer is now supported.

  • OracleContainer can now be used with R2DBC.

As part of these enhancements, the support has moved to a new spring-boot-testcontainers module. Please refer to the updated reference documentation for further details.

Docker Compose

A new module, spring-boot-docker-compose, provides integration with Docker Compose. When your app is starting up, the Docker Compose integration will look for a configuration file in the current working directory. The following files are supported:

  • compose.yaml

  • compose.yml

  • docker-compose.yaml

  • docker-compose.yml

To use a non-standard file, set the spring.docker.compose.file property.

By default, the services declared in the configuration file will be started up using docker compose up and connection details beans for those services will be added to the application context so that the services can be used without any further configuration. When the application stops, the services will then be shut down using docker compose down. This lifecycle management and the commands used to start up and shut down the services can be customized using the spring.docker.compose.lifecycle-management, spring.docker.compose.startup.command, and spring.docker.compose.shutdown.command configuration properties.

The following services are supported:

  • Elasticsearch

  • MariaDB with JDBC and R2DBC

  • MongoDB

  • MySQL with JDBC and R2DBC

  • PostgreSQL with JDBC and R2DBC

  • RabbitMQ

  • Redis

  • Zipkin

Please refer to the updated reference documentation for further details.

SSL Configuration

SSL trust material such as Java KeyStores and PEM-encoded certificates can now be configured using properties and applied to connections of various types such as embedded web servers, data services, RestTemplate and WebClient in a more consistent manner.

Please refer to the updated reference documentation for more information.

Docker Image Building

Image Created Date and Time

The spring-boot:build-image Maven goal and bootBuildImage Gradle task now have a createdDate configuration option that can be used to set the value of the Created field in the generated image’s metadata to a user-specified date or to now to use the current date and time. See the Gradle and Maven plugin documentation for more information.

Image Application Directory

The spring-boot:build-image Maven goal and bootBuildImage Gradle task now have an applicationDirectory configuration option that can be used to set the location in the builder image that application content will be uploaded to for buildpacks to consume. This will also be the location of the application content in the generated image. See the Gradle and Maven plugin documentation for more information.

Property-based ConnectionDetails Beans

In the absence of an appropriate …ConnectionDetails bean being defined elsewhere, Spring Boot’s auto-configurations have been updated to define their own based backed by the relevant configuration properties. This allows …ConnectionDetails to be injected without having to handle the case where no such bean is available and a fallback to property-based configuration is required.

Support for Device Grants with Spring Authorization Server

Support for device grants has been added to the auto-configuration for Spring Authorization Server. Three new properties have been introduced under spring.security.oauth2.authorizationserver.client.[registration-id]:

  • endpoint.device-authorization-uri

  • endpoint.device-verification-uri

  • token.device-code-time-to-live

Support for Exporting Traces Using OTLP

When io.opentelemetry:opentelemetry-exporter-otlp is on the classpath, an OtlpHttpSpanExporter will be auto-configured. The configuration of the exporter can be customized using the management.otlp.tracing.* configuration properties.

Miscellaneous

Apart from the changes listed above, there have also been lots of minor tweaks and improvements including:

  • Aggregation temporality configuration support for Micrometer’s OtlpMeterRegistry.

  • Support for additional colors in Log4j2 and Logback.

  • Dependency management for the R2DBC MySQL driver (io.asyncer:r2dbc-mysql) has been added.

  • Dependency management for the R2DBC MariaDB driver (org.mariadb:r2dbc-mariadb) has been added.

  • When using OpenTelemetry, the SdkTracerProviderBuilder that is used to create the auto-configured SdkTracerProvider can be customised by defining an SdkTracerProviderBuilderCustomizer bean.

  • MockServerRestTemplateCustomizer now supports enable content buffering through a new setBufferContent method.

  • The conversion service using by Spring Batch when it is auto-configured can now be customised by defining a BatchConversionServiceCustomizer bean.

  • The builder used to create the JTW decoder for a JWK Set URI can be customised by defining a JwkSetUriReactiveJwtDecoderBuilderCustomizer or JwkSetUriJwtDecoderBuilderCustomizer bean.

Deprecations in Spring Boot 3.1.0-RC1

  • org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientPropertiesRegistrationAdapter in favor of org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientPropertiesMapper.

  • org.springframework.boot.web.server.SslStoreProvider has been deprecated in favor of SSL bundles.

Clone this wiki locally