Skip to content

Spring Boot 3.2.0 M1 Release Notes

Andy Wilkinson edited this page Jul 21, 2023 · 57 revisions

Spring Boot 3.2.0-M1 Release Notes

Upgrading from Spring Boot 3.1

Logged Application Name

The default log output now includes your application name whever you have a spring.application.name property set. If you prefer the previous format, you can set logging.include-application-name to false.

Kotlin 1.9.0 and Gradle

There’s a bug in 1.9.0 of the Kotlin Gradle Plugin that causes additional resource directories to be lost. This breaks native image compilation as resources generated by AOT processing are not included in the native image’s classpath. To work around the problem, apply Kotlin’s Gradle plugin first.

Minimum Requirements Changes

None.

Deprecations from Spring Boot 3.0

Classes, methods, and properties that were deprecated in Spring Boot 3.0 have been removed in this release. Please ensure that you aren’t calling deprecated methods before upgrading.

New and Noteworthy

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

Support for Virtual Threads

Spring Boot 3.2 ships support for virtual threads. To use virtual threads, you need to run on Java 21 and set the property spring.threads.virtual.enabled to true.

Servlet Web Servers

When virtual threads are enabled, Tomcat and Jetty will use virtual threads for request processing. This means that your application code that is handling a web request, such as a method in a controller, will run on a virtual thread.

Task Execution

When virtual threads are enabled, the applicationTaskExectuor bean will be a SimpleAsyncTaskExecutor configured to use virtual threads. Anywhere that uses the application task executor, such as @EnableAsync when calling @Async methods, Spring MVC’s asynchronous request processing, and Spring WebFlux’s blocking execution support will now utilize virtual threads. As before, any TaskDecorator bean is applied to the auto-configured executor and the spring.task.execution.thread-name-prefix property is applied. Other spring.task.execution.* properties are ignored as they are specific to a pool-based executor.

Blocking Execution with Spring WebFlux

Spring WebFlux’s support for block execution is auto-configured to use the applicationTaskExecutor bean when it is an AsyncTaskExecutor. The applicationTaskExecutor is an AsyncTaskExecutor both by default and when virtual threads are enabled.

Spring for GraphQL’s Callable Support

Spring for GraphQL is now auto-configured to use the applicationTaskExecutor. This enables out of the box support for controller methods that return Callable.

Observability Improvements

Observations starting with a prefix can now be disabled via properties. For example, to prevent Spring Security from reporting observations, set management.observations.enable.spring.security=false.

The property management.observations.key-values.* can be used to automatically apply low-cardinality key-values to all observations. For example setting management.observations.key-values.region=us-west will add the key region with the value us-west to all observations.

The default value of management.otlp.tracing.endpoint has been removed. The OtlpHttpSpanExporter bean is now only auto-configured if management.otlp.tracing.endpoint has a value. To restore the old behavior, set management.otlp.tracing.endpoint=http://localhost:4318/v1/traces.

If you are using AspectJ, ObservedAspect is now auto-configured to intercept types or methods annotated with @Observed.

If you’re using OpenTelemetry and you want more control over the applied SpanProcessor, you can now define a bean of type SpanProcessors. By default, all available SpanProcessor beans are applied. The same works with OpenTelemetry’s SpanExporter, use a SpanExporters bean to override the default. By default it applies all available SpanExporter beans.

If an OpenTelemetry MeterProvider bean is found, it is automatically registered on the BatchSpanProcessor.

Micrometer Tracing’s ObservationHandler beans are automatically registered on the ObservationConfig. Before Spring Boot 3.2.0, uncategorized handlers have been registered before the categorized ones. This has been flipped, categorized handlers are now registered before the uncategorized ones. See #34399 for details.

The default format for B3 trace propagation has been changed from single-no-parent to single.

@Scheduled methods are now instrumented for observability.

Observability in Tests

Before Spring Boot 3.2 the whole Micrometer Tracing, Brave and OpenTelemetry infrastructure has been disabled when running integration tests. This has been reworked: only the minimum number of beans are disabled so that no spans are sent to backends (see #35354 for the list of beans which will be disabled). If you have custom Brave SpanHandler or OpenTelemetry SpanExporter beans, please make sure to annotate them with @ConditionalOnEnabledTracing so that they won’t be created when running integration tests with observability switched off.

In case you want to run your integration tests with observability enabled, you can use the @AutoConfigureObservability annotation on the test class.

Logging Correlation IDs

Spring Boot will now automatically log correlation ID whenever you are using Micrometer tracing. See the updated documenation for details.

RestClient Support

Spring Boot 3.2 includes support for the new RestClient interface which has been introduced in Spring Framework 6.1. This interface provides a functional style blocking HTTP API with a similar to design to WebClient.

Existing and new application might want to consider using RestClient as an alternative to RestTemplate.

RestTemplate HTTP Clients

When Jetty’s HttpClient is on the classpath, Spring Boot’s HTTP client auto-detection will now configure RestTemplateBuilder to use the new JettyClientHttpRequestFactory that was introduced in Spring Framework 6.1.

Support for JdkClientHttpRequestFactory has been added to ClientHttpRequestFactories. Unlike JettyClientHttpRequestFactory it has not been added to the auto-detection. To use JdkClientHttpRequestFactory you must opt in:

@Bean
RestTemplateBuilder restTemplateBuilder(RestTemplateBuilderConfigurer configurer) {
    return configurer.configure(new RestTemplateBuilder())
        .requestFactory(
                (settings) -> ClientHttpRequestFactories.get(JdkClientHttpRequestFactory.class, settings));
}

Docker Image Building

Docker Host Configuration

The spring-boot:build-image Maven goal and bootBuildImage Gradle task now use Docker CLI configuration files to determine the host address and other connection details for the Docker daemon that should be used by default. See the Gradle and Maven plugin documentation for more information.

Additional OAuth2 Token Validators

The auto-configured JwtDecoder or ReactiveJwtDecoder will now use any OAuth2TokenValidator<Jwt> beans for token validation. They are included in a DelegatingOAuth2TokenValidator that is configured as the decoder’s validator.

Service Connection Support for ActiveMQ

Support for ServiceConnection has been added for ActiveMQ, with integration for both Testcontainers and Docker Compose. The integration uses the symptoma/activemq image.

Dependency Upgrades

Spring Boot 3.2.0-M1 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:

  • Added a property to configure the maximum amount of connections for Jetty servers.

  • The port information logged when an embedded WebServer starts has been improved and made more consistent.

  • Added a property to configure the base TimeUnit of exported metrics in OTLP registry.

  • A new property, flyway.postgresql.transactional-lock can be used to configure Flyway’s use of transactional locks with PostgreSQL.

  • When creating a PemSslStoreBundle programatically, a key store password can now be provided.

Deprecations in Spring Boot 3.2.0-M1

  • Deprecated management.metrics.tags., please use management.observations.key-values. instead

  • Most constants defined in LoggingSystemProperties and LogbackLoggingSystemProperties have been deprecated in favor of enum values

  • Support for enabled request buffering in ClientHttpRequestFactorySettings and RestTemplateBuilder has been deprecated. While the API remains in deprecated form, configuring it will have no effect following similar changes in Spring Framework 6.1.

  • Registering additional ApplicationContextInitializer using the context.initializer.classes environment property is deprecated in favor of registering each delegate programatically or in spring.factories.

  • Registering additional ApplicationListener using the context.listener.classes environment property is deprecated in favor of registering each delegate programatically or in spring.factories.

  • Flyway properties that are managed by an extension have moved to a dedicated namespace. As a result, flyway.oracle* properties have moved to flyway.oracle.*. Similarly, the spring.flyway.sql-server-kerberos-login-file has moved to spring.flyway.sqlserver.kerberos-login-file.

  • Support for InfluxDB has been deprecated in favor of the new InfluxDB Java client and its own Spring Boot integration.

Clone this wiki locally