Skip to content

Spring Boot 3.1.0 M2 Release Notes

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

Spring Boot 3.1.0-M2 Release Notes

For changes in earlier milestones, please refer to:

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 the configuration changelog for a complete overview of the changes in configuration.

Auto-configuration for Spring Authorization Server

This release ships support for the Spring Authorization Server project along with a new spring-boot-starter-oauth2-authorization-server starter. More information can be found in the 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:

@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

@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 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 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 #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 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:

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

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

Clone this wiki locally