Spring Boot 2.7.6 Release Notes

0 views
Skip to first unread message

Brian Scarano

unread,
Aug 4, 2024, 5:03:20 PM8/4/24
to diamamomo
Supportfor Apache HttpClient 4 with RestTemplate was removed in Spring Framework 6, in favor of Apache HttpClient 5. Spring Boot 3.0 includes dependency management for both HttpClient 4 and 5. Applications that continue to use HttpClient 4 can experience errors when using RestTemplate that are difficult to diagnose.

The ServletRegistrationBean and FilterRegistrationBean classes will now fail with an IllegalStateException rather than logging a warning if registration fails.If you need the old behavior, you should call setIgnoreRegistrationFailure(true) on your registration bean.


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.


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.


The configured membership of a health group is now validated on startup.If a health indicator that does not exist has been included or excluded, startup will fail.This validation can be disabled, restoring the behavior of earlier versions, by setting management.endpoint.health.validate-group-membership to false.


The spring-boot-starter-parent now uses maven.compiler.release to configure the Java version instead of maven.compiler.source and maven.compiler.target. The source and target properties have been removed. If you use them somewhere in your build, please migrate to maven.compiler.release.


To contribute properties from Container @Bean methods, DynamicPropertyRegistry can now be injected.This works in a similar way to @DynamicPropertySource that you can use in tests.Please refer to the reference documentation for further details.


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


A new module, spring-boot-docker-compose, provides integration with Docker Compose.When your app is starting up, the Docker Compose integration will look for a configuration file in the current working directory.The following files are supported:


By default, the services declared in the configuration file will be started up using docker compose up and connection details beans for those services will be added to the application context so that the services can be used without any further configuration.When the application stops, the services will then be shut down using docker compose down.This lifecycle management and the commands used to start up and shut down the services can be customized using the spring.docker.compose.lifecycle-management, spring.docker.compose.startup.command, and spring.docker.compose.shutdown.command configuration properties.


SSL trust material such as Java KeyStores and PEM-encoded certificates can now be configured using properties and applied to connections of various types such as embedded web servers, data services, RestTemplate and WebClient in a more consistent manner.


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.


The spring-boot:build-image Maven goal and bootBuildImage Gradle task now have an applicationDirectory configuration option that can be used to set the location in the builder image that application content will be uploaded to for buildpacks to consume. This will also be the location of the application content in the generated image. See the Gradle and Maven plugin documentation for more information.


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


When io.opentelemetry:opentelemetry-exporter-otlp is on the classpath, an OtlpHttpSpanExporter will be auto-configured.The configuration of the exporter can be customized using the management.otlp.tracing.* configuration properties.


You can now limit the maximum HTTP response header size if you are using Tomcat or Jetty.For Tomcat you can use the server.tomcat.max-http-response-header-size property and for Jetty you can use server.jetty.max-http-response-header-size.By default, response headers are limited to 8kb.


org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientPropertiesRegistrationAdapter in favor of org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientPropertiesMapper.


Dependency management for Dropwizard Metrics has been removed.Spring Boot does not depend directly upon Dropwizard Metrics and, therefore, does not require a specific version.If your application depends on Dropwizard Metrics directly, update your build configuration to specify a version that meets its needs.


Spring Boot 3.3 includes support for the Prometheus Client 1.x.This release of the client contains some breaking changes, e.g. changes to the exported metric names.Use of the Prometheus Push Gateway is not supported with the 1.x client, until this support has been added from the Prometheus maintainers.


If you want to continue to use the 0.x version of the Prometheus client, remove io.micrometer:micrometer-registry-prometheus from your dependencies and add io.micrometer:micrometer-registry-prometheus-simpleclient instead.Spring Boot contains auto-configuration for simpleclient in a deprecated form which will be removed in Spring Boot 3.5.0.


This release upgrades to Flyway 10.Flyway 10 is more modular than previous versions and support for several databases has been moved into a number of new, database-specific modules.If you are using any of the following databases, update your dependencies accordingly:


This release upgrades to Infinispan 15.Infinispan 15 has raised its Jakarta EE baseline and, as such, a number of its -jakarta modules, such as infinispan-core-jakarta, no longer exist. Use their standard alternatives, such as infinispan-core, instead.


CDS is a JVM feature that can help reduce the startup time and memory footprint of Java applications. Spring Boot now has support for easy creation of a CDS friendly layout. This layout can be created by extracting the uber JAR with the help of the tools jarmode:


This creates a your-application/your-application.jar and the needed libraries in a your-application/lib folder. The application can then be executed with java -jar your-application/your-application.jar.


If you have used layers.enabled = false in your Gradle build file or false in your Maven pom.xml, please note that disabling layers no longer prevents the inclusion of the jarmode JAR. Use includeTools on the BootJar or BootWar task or false on the spring-boot-maven-plugin for that.


Brave has been updated to 6.0, and Zipkin to 3.0. With that upgrade, the Zipkin support in Spring Boot got new features, like specifying the encoding in which data is reported to the Zipkin API. See #39049 for details.


A new JDK HttpClient based Zipkin sender has been implemented. This sender only depends on the JDK and will be the default sender in Spring Boot 3.5.0, superseding the WebClient and RestTemplate sender implementations.


Service connection support for Apache ActiveMQ Artemis has been added.The Testcontainers support works with the ArtemisContainer container, the Docker Compose support works with the apache/activemq-artemis image.


The Spring Boot support for Docker Compose will detect and configure containers from Bitnami in addition to official images for several of the supported technologies, including Cassandra, Elasticsearch, MariaDB, MySQL, MongoDB, Neo4j, PostgreSQL, RabbitMQ, and Redis. See the updated reference documentation for more information.


If a AsyncTaskExecutor is available in the context, it is now registered on the websocket ChannelRegistration.If using virtual threads, this will usually be a virtual threads enabled SimpleAsyncTaskExecutor, making Websockets virtual thread capable.


When configuring a Tomcat, Netty, or Undertow embedded web server with SSL/TLS, it is now possible to configure multiple hostnames with unique trust material for each to support Server Name Indication (SNI).See the updated documentation for more information on the configuration options.


If you're interested in helping out, check out the "ideal for contribution" tag in the issue repository. If you have general questions, please ask at stackoverflow.com using the spring-boot tag or chat with the community on Gitter.


If you're interested in helping out, check out the "ideal for contribution" tag in the issue repository. If you have general questions, please ask on stackoverflow.com using the spring-boot tag or chat with the community on Gitter.

3a8082e126
Reply all
Reply to author
Forward
0 new messages