Skip to content

Spring Boot 3.2.0 M1 Release Notes

Stéphane Nicoll edited this page Jul 17, 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.

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 and Spring MVC’s asynchronous request processing, 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.

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.

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));
}

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.

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

  • When registering ObservationHandler, custom handlers are now registered after the infrastructure handlers. See #34399 for details.

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

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.

Clone this wiki locally