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

= Spring Boot 3.1.0-M2 Release Notes

For changes in earlier milestones, please refer to:

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



== Upgrading from Spring Boot 3.0



=== Minimum Requirements Changes
None.


=== Git Commit ID Maven Plugin Version Property
The property used to override the version of `io.github.git-commit-id:git-commit-id-maven-plugin` has been updated to align with its artifact name. To adapt to this change replace `git-commit-id-plugin.version` with `git-commit-id-maven-plugin.version` in your `pom.xml`.



=== Spring Kafka Retry Topic Auto-configuration

When using Apache Kafka with auto-configured retryable topic configuration (`spring.kafka.retry.topic.enabled: true`), with an exponential back off with a `maxDelay`, all retries at the `maxDelay` level are now sent to the same topic. 
Previously a separate topic was used for each retry, even if the max delay was exceeded.

For example, with a max retry attempts of `5`, delay of `1s`, a multiplier of `2`, and a max delay of `3s`, after the initial failure, retries will be performed at 1s, 2s, 3s, 3s. 
With previous versions of Spring Boot, the framework would create 6 topics: `someTopic`, `someTopic-retry-0`, `someTopic-retry-1`, `someTopic-retry-2`, `someTopic-retry-3`, and `someTopic-dlt`.
With this change, the `someTopic-retry-3` topic will not be created, but instead all 3 second retries will be in `someTopic-retry-2`.
After migrating from an earlier Spring Boot version, you can safely delete the `someTopic-retry-3` topic after all records have been consumed. 



=== Dependency Management for Testcontainers
Spring Boot's dependency management now includes Testcontainers.
If necessary, the version that is managed by Spring Boot can be overridden using the `testcontainers.version` property.



== New and Noteworthy
TIP: Check link:Spring-Boot-3.1.0-M2-Configuration-Changelog[the configuration changelog] for a complete overview of the changes in configuration.



=== Auto-configuration for Spring Authorization Server
This release ships support for https://spring.io/projects/spring-authorization-server[the Spring Authorization Server] project along with a new `spring-boot-starter-oauth2-authorization-server` starter. More information can be found in the {reference-docs}web.html#web.security.oauth2.authorization-server[Authorization Server section of the Spring Boot reference documentation]. 



=== Service Connections
A new service connection concept has been introduced.
Such connections are represented in an application by `ConnectionDetails` beans.
These beans provide the necessary details to establish a connection to a remove service and Spring Boot's auto-configuration has been updated to consume `ConnectionDetails` beans.
When such beans are available, they will take precedence over any connection-related configuration properties.
Configuration properties that are not related to the connection itself, such as properties that control the size and behavior of a connection pool, will still used.

This low-level feature is intended as a building block for other higher-level features that auto-configure service connections by defining `ConnectionDetails` beans. The first such feature is improved Testcontainers integration.



==== Testcontainers Service Connections
When using Testcontainers, `@DynamicPropertySource` is commonly used to configure application properties based on the container's settings:

[source,java]
----
@Container
static GenericContainer redis = new GenericContainer(DockerImageName.parse("redis").withTag("4.0.14"));

// …

@DynamicPropertySource
static void redisProperties(DynamicPropertyRegistry registry) {
	registry.add("spring.data.redis.host", redis::getHost);
	registry.add("spring.data.redis.port", redis::getFirstMappedPort);
}
----

This can now be samplified to the following

[source,java]
----
@Container
@RedisServiceConnection
static GenericContainer redis = new GenericContainer(DockerImageName.parse("redis").withTag("4.0.14"));
----

Here, `@RedisServiceConnection` indicates that the container should be used a source of Redis connection details. `spring-boot-test-autoconfigure`, which provides the `@RedisServiceConnection` annotation, will extract those details from the container while still allowing the Testcontainers API to be used to define and configure it.

Please see the {reference-docs}features.html#features.testing.testcontainers.service-connections[updated reference documentation] for a complete list of the currently supported `@…ServiceConnection` annotations.
Note that a single container can provide multiple connections. For example, a `PostgreSQLContainer` could be annotated with both `@JdbcServiceConnection` and `@R2dbcServiceConnection`.



=== Wavefront Span Tag Customization
If you're using Wavefront and you want to https://docs.wavefront.com/tracing_customize_spans_and_alerts.html[customize span tags for RED metrics], there's now a new property called `management.wavefront.trace-derived-custom-tag-keys` which allows you to do this. See https://github.com/spring-projects/spring-boot/issues/34194[#34194] for details.



=== Spring for GraphQL 



==== Exception Handling
`@GraphQlExceptionHandler` methods declared in controllers or `@ControllerAdvice` are now supported out-of-the box by Spring for GraphQL for controller method invocations. Additionally, Spring Boot auto-configures `@ControllerAdvice` exception handling for other (non-controller) `DataFetcher` implementations like `QueryDslDataFetcher`, `QueryByExampleDataFetcher`, and others through configuration of the `GraphQlSource`.



==== Pagination and Sorting
When Spring Data is on the classpath, Spring for GraphQL is now auto-configured with support for pagination and sorting.



==== Improved Schema Type Generation
The `GraphQlSource` is now auto-configured with a `ConnectionTypeDefinitionConfigurer`.
It generates "Connection" types by looking for fields whose type definition name ends in "Connection", considered by the
https://relay.dev/graphql/connections.htm[GraphQL Cursor Connections Specification] to be a `Connection Type`, and adding the required type definitions if they don't already exist.



=== Reverted Support for JoranConfigurators in AOT Processing
The support for using JoranConfigurator beans in AOT processing that was added in 3.1.0-M1 has been reverted.
With hindsight, this change moved things in the wrong direction.
More time is required to provide comprehensive support for programmatic configuration of Logback.



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

* https://github.com/spring-projects/spring-data-bom/releases/tag/2023.0.0-M3[Spring Data 2023.0.0-M3]
* https://github.com/spring-projects/spring-graphql/releases/tag/v1.2.0-M1[Spring GraphQL 1.2.0-M1]
* https://github.com/spring-projects/spring-hateoas/releases/tag/2.1.0-M1[Spring HATEOAS 2.1.0-M1]
* https://github.com/spring-projects/spring-integration/releases/tag/v6.1.0-M2[Spring Integration 6.1.0-M2]
* https://github.com/spring-projects/spring-security/releases/tag/6.1.0-M2[Spring Security 6.1.0-M2]
* https://github.com/spring-projects/spring-session/releases/tag/3.1.0-M1[Spring Session 3.1.0-M1]

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

* https://github.com/graphql-java/graphql-java/releases/tag/v20.1[GraphQL Java 20.1]
* https://forum.liquibase.org/t/liquibase-4-20-released/7874[Liquibase 4.20]
* https://github.com/micrometer-metrics/micrometer/releases/tag/v1.11.0-M2[Micrometer 1.11.0-M2]
* https://github.com/micrometer-metrics/tracing/releases/tag/v1.1.0-M2[Micrometer Tracing 1.1.0-M2]
* https://github.com/open-telemetry/opentelemetry-java/releases/tag/v1.24.0[OpenTelemetry 1.24.0]
* https://github.com/rabbitmq/rabbitmq-java-client/releases/tag/v5.17.0[Rabbit AMQP Client 5.17.0]



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

* A `withSanitizedValue` utility method has been added to `SanitizableData`
* `RabbitTemplateCustomizer` has been introduced. Beans of this type will customize the auto-configured `RabbitTemplate`
* CNB Platform API 0.11 is now supported
* `spring-boot-starter-parent` sets `maven.compiler.release` to the configured Java version
* `build-info` goal can now be skipped by setting `-Dspring-boot.build-info.skip`



== Deprecations in Spring Boot 3.1.0-M2

* `MongoPropertiesClientSettingsBuilderCustomizer` in favor of `StandardMongoClientSettingsBuilderCustomizer`
