https://chatgpt.com/g/g-dHq8Bxx92-master-spring-ter

A Deep Dive into the Latest Spring Boot 3.4.0-M3 Release: Enhancements, Changes, and What You Need to Know

Master Spring Ter
4 min readSep 25, 2024

Spring Boot continues to evolve, bringing with it improvements and new features that aim to enhance developer productivity and application performance. The upcoming 3.4.0-M3 release is no exception. In this article, we’ll explore the latest changes, including updates to auto-configuration, graceful shutdown improvements, and exciting new features in the Spring ecosystem.

Need help with Spring Framework? Master Spring TER, a ChatGPT model, offers real-time troubleshooting, problem-solving, and up-to-date Spring Boot info. Click here for expert support!

Minimum Requirements: A Quick Recap

There are no changes to the minimum requirements for this release. This means that if your current setup supports Spring Boot 3.x, you can seamlessly upgrade to 3.4.0-M3 without worrying about compatibility issues.

Enhancing @AutoConfigureTestDatabase for Containers

The @AutoConfigureTestDatabase annotation has been upgraded to automatically detect if a database is sourced from a container. Previously, using @AutoConfigureTestDatabase with containerized databases required the replace=Replace.NONE attribute. With this release, this manual configuration is no longer necessary, simplifying your test setup.

For those who prefer the previous behavior, you can revert by setting replace=Replace.AUTO_CONFIGURED on the annotation.

Graceful Shutdown by Default

Graceful shutdown is now enabled by default for embedded web servers like Jetty, Reactor Netty, Tomcat, and Undertow. This ensures that ongoing requests are completed before the server shuts down, providing a better user experience during restarts and deployments.

If you prefer the immediate shutdown approach, you can restore the old behavior by setting server.shutdown to immediate.

Embedded Broker Support with ActiveMQ Classic

The reintroduction of embedded broker support in ActiveMQ Classic has been eagerly awaited. The Spring Boot auto-configuration now fully supports it. Note that, unlike in Spring Boot 2.7.x, the ActiveMQ starter is now client-only. To leverage the embedded broker functionality, you must include the org.apache.activemq:activemq-broker dependency in your application.

Spring for Apache Pulsar: New Customization Options

Spring Boot 3.4.0-M3 introduces several enhancements for integrating with Apache Pulsar:

  • A new PulsarContainerFactoryCustomizer interface allows you to customize the auto-configured Pulsar container factory.
  • The spring.pulsar.consumer.subscription.name property now applies to the auto-configured Pulsar listener container.
  • Two new configuration properties have been introduced for the Pulsar client’s concurrency:
  • spring.pulsar.client.threads.io: Controls the number of threads for handling connections to brokers.
  • spring.pulsar.client.threads.listener: Controls the number of threads for message listeners.
  • The spring.pulsar.listener.concurrency property allows you to control the concurrency of the auto-configured Pulsar message listener container.

These changes provide more flexibility and control over your Pulsar integration, enabling you to fine-tune performance and resource usage according to your needs.

Observability Improvements

Observability continues to be a focus in Spring Boot 3.4.0-M3. Notable updates include:

  • Support for OTLP spans over the gRPC transport. To enable this, set the management.otlp.tracing.transport property to grpc. The default is still http.
  • Docker Compose and Testcontainers support for OTLP logging, making it easier to work with these tools in a containerized environment.
  • Structured logging now supports the Graylog Extended Log Format (GELF), expanding the options for log integration.

Deprecating and Replacing Auto-configuration Classes

To facilitate the evolution of auto-configuration, this release introduces support for deprecating and replacing auto-configuration classes. Replacements can be declared in a new META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.replacements file. This change aims to provide a smoother migration path and clearer guidance when configurations are deprecated or replaced.

Dependency Upgrades

Spring Boot 3.4.0-M3 updates several key dependencies, ensuring that your applications benefit from the latest features and security improvements:

  • Spring AMQP 3.2.0-M3
  • Spring Authorization Server 1.4.0-M2
  • Spring Batch 5.2.0-M1
  • Spring Data 2024.1.0-M1
  • Spring Framework 6.2.0-RC1
  • Spring HATEOAS 2.4.0-RC1
  • Spring Kafka 3.3.0-M3
  • Spring Integration 6.4.0-M3
  • Spring Pulsar 1.2.0-M2
  • Spring Security 6.4.0-M4

In addition, several third-party dependencies have been upgraded, including Artemis 2.37, Elasticsearch Client 8.15, Flyway 10.18, and many more.

Miscellaneous Improvements

Several minor yet impactful changes have been made:

  • A new configuration property, spring.data.web.pageable.serialization-mode, for configuring Spring Data Web’s serialization mode.
  • The SpringApplication.from(…​) syntax now supports specifying additional profiles to activate.
  • The Spring Boot plugin no longer sets BP_NATIVE_IMAGE: true in the buildpack environment.
  • @ConfigurationProperties beans now respect annotations like @DependsOn, @Description, @Fallback, and others.
  • Support for Testcontainer’s RedisContainer has been added.
  • A new configuration property, spring.jms.listener.max-messages-per-task, for configuring the maximum number of messages a listener processes in one task.

Deprecations

Several configurations and classes have been deprecated, including:

  • org.springframework.boot.actuate.autoconfigure.tracing.otlp.OtlpTracingConnectionDetails#getUrl() in favor of getUrl(Transport).
  • org.springframework.boot.actuate.autoconfigure.tracing.OpenTelemetryAutoConfiguration in favor of org.springframework.boot.actuate.autoconfigure.tracing.OpenTelemetryTracingAutoConfiguration.

Conclusion

Spring Boot 3.4.0-M3 brings a host of improvements that enhance the overall developer experience and application performance. From better container integration in testing to enhanced observability and the return of embedded broker support with ActiveMQ Classic, this release has something for everyone.

As always, be sure to check the official changelog for a complete overview of the updates and to ensure a smooth upgrade path. Happy coding!

generated by master-spring-ter

--

--