:reference-docs: https://docs.spring.io/spring-boot/docs/3.1.0-SNAPSHOT/reference/html/

= Spring Boot 3.1.0-RC1 Release Notes

For changes in earlier milestones, please refer to:

- link:Spring-Boot-3.1.0-M1-Release-Notes[v3.1.0-M1]
- link:Spring-Boot-3.1.0-M2-Release-Notes[v3.1.0-M2]



== Upgrading from Spring Boot 3.0



=== Hibernate 6.2
Spring Boot 3.1 upgrades to Hibernate 6.2. Please refer to the https://docs.jboss.org/hibernate/orm/6.2/migration-guide/migration-guide.html[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 https://github.com/FasterXML/jackson/wiki/Jackson-Release-2.15[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
https://github.com/mockito/mockito/releases/tag/v5.0.0[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 link:Spring-Boot-3.1.0-RC1-Configuration-Changelog[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 
https://docs.spring.io/spring-boot/docs/3.1.0-SNAPSHOT/reference/html/features.html#features.testing.testcontainers.at-development-time[updated reference documentation] for further details.



==== Service Connections
The support for creating service connections from TestContainers-managed containers, https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.1.0-M2-Release-Notes#testcontainers-service-connections[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 {reference-docs}features.html#features.testing.testcontainers.service-connections[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 {reference-docs}features.html#features.docker-compose[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 https://docs.spring.io/spring-boot/docs/3.1.0-SNAPSHOT/reference/html/features.html#features.ssl[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 https://docs.spring.io/spring-boot/docs/current-SNAPSHOT/gradle-plugin/reference/htmlsingle/#build-image.customization[Gradle] and https://docs.spring.io/spring-boot/docs/current-SNAPSHOT/maven-plugin/reference/htmlsingle/#build-image.customization[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 https://docs.spring.io/spring-boot/docs/current-SNAPSHOT/gradle-plugin/reference/htmlsingle/#build-image.customization[Gradle] and https://docs.spring.io/spring-boot/docs/current-SNAPSHOT/maven-plugin/reference/htmlsingle/#build-image.customization[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.



=== Dependency Upgrades
Spring Boot 3.1.0-RC1 moves to new versions of several Spring projects:

* https://github.com/spring-projects/spring-authorization-server/releases/tag/1.1.0-RC1[Spring Authorization Server 1.1.0-RC1]
* https://github.com/spring-projects/spring-data-bom/releases/tag/2023.0.0-RC1[Spring Data Bom 2023.0.0-RC1]
* https://github.com/spring-projects/spring-integration/releases/tag/v6.1.0-RC1[Spring Integration 6.1.0-RC1]
* https://github.com/spring-projects/spring-graphql/releases/tag/v1.2.0-RC1[Spring GraphQL 1.2.0-RC1]
* https://github.com/spring-projects/spring-hateoas/releases/tag/2.1.0-RC1[Spring HATEAOAS 2.1.0-RC1]
* https://github.com/spring-projects/spring-ldap/releases/tag/3.1.0-RC1[Spring LDAP 3.1.0-RC1]
* https://github.com/spring-projects/spring-security/releases/tag/6.1.0-RC1[Spring Security 6.1.0-RC1]
* https://github.com/spring-projects/spring-session/releases/tag/3.1.0-RC1[Spring Session 3.1.0-RC1]

Numerous third-party dependencies have also been updated, some of the more noteworthy of which are the following:

* https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/release-highlights.html#_version_8_7[Elasticsearch Client 8.7]
* https://in.relation.to/2023/03/30/orm-62-final/[Hibernate 6.2]
* https://github.com/FasterXML/jackson/wiki/Jackson-Release-2.15#changes-compatibility[Jackson 2.15.0-rc3]
* https://github.com/micrometer-metrics/micrometer/releases/tag/v1.11.0-RC1[Micrometer 1.11.0-RC1]
* https://github.com/micrometer-metrics/tracing/releases/tag/v1.1.0-RC1[Micrometer Tracing 1.1.0-RC1]
* https://github.com/mockito/mockito/releases/tag/v5.3.0[Mockito 5.3]open
* https://github.com/open-telemetry/opentelemetry-java/releases/tag/v1.25.0[OpenTelemetry 1.25]
* https://github.com/testcontainers/testcontainers-java/releases/tag/1.18.0[Testcontainers 1.18]



=== 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.
