:reference-docs: https://docs.spring.io/spring-boot/3.4-SNAPSHOT/reference
:how-to-docs: https://docs.spring.io/spring-boot/3.4-SNAPSHOT/how-to
:api-docs: https://docs.spring.io/spring-boot/3.4-SNAPSHOT/api
:maven-docs: https://docs.spring.io/spring-boot/3.4-SNAPSHOT/maven-plugin
:gradle-docs: https://docs.spring.io/spring-boot/3.4-SNAPSHOT/gradle-plugin

= Spring Boot 3.4.0-M2 Release Notes

For changes in earlier milestones, please refer to:

- link:Spring-Boot-3.4.0-M1-Release-Notes[v3.4.0-M1]



== Upgrading from Spring Boot 3.3


=== Cloud Foundry ConditionalOnAvailableEndpoint Exposure
The `EndpointExposure.CLOUD_FOUNDRY` enum value used with the `@ConditionalOnAvailableEndpoint` has been deprecated in favor of `EndpointExposure.WEB`.
Typical Spring Boot application will probably not be effected by this change, however, if you have custom Cloud Foundry specific actuator endpoint beans you should update your conditions to use `EndpointExposure.WEB`.



=== Minimum Requirements Changes
None.



== New and Noteworthy
TIP: Check link:Spring-Boot-3.4.0-M2-Configuration-Changelog[the configuration changelog] for a complete overview of the changes in configuration.






==== `@Fallback` Beans
`@ConditionalOnSingleCandidate` now supports `@Fallback` beans.
The condition will match if there's a single primary bean or, if there are no primary beans, if there's a single non-fallback bean.



==== Defining Additional Beans
When type matching, bean-based conditions will now ignore any beans that are not default candidates.
By declaring that a bean is not a default candidate (using `@Bean(defaultCandidate=false)`), a bean of an auto-configured type can now be defined without causing the auto-configure bean of the same type to back off. This reduces the configuration required to, for example, use {how-to-docs}/data-access.html#howto.data-access.configure-two-datasources[two `DataSource` beans] or {how-to-docs}/data-access.html#howto.data-access.use-multiple-entity-managers[two `EntityManagerFactory`] beans in the same application.



=== SSL information and health check
If you're using SSL bundles, there's now a new endpoint showing SSL information (validity dates, issuer, subject, etc.) available under `/actuator/info`.
This endpoint also shows soon to be expired certificates to alert you that they need to be rotated soon. There's a new configuration property named `management.health.ssl.certificate-validity-warning-threshold` to configure the threshold.

A new health check monitoring the SSL certificates has been added, too. If a certificate is invalid, it sets the status to `OUT_OF_SERVICE`.



=== Additional info in `/actuator/scheduledtasks` endpoints
{api-docs}/rest/actuator/scheduledtasks.html#scheduled-tasks.retrieving[The `/scheduledtasks` Actuator endpoint] now exposes additional metadata about scheduled tasks, such as "next scheduled execution time" and "last execution time, status and exception".



=== Docker Compose Improvements



==== Grafana LGTM
Support for https://grafana.com/blog/2024/03/13/an-opentelemetry-backend-in-a-docker-image-introducing-grafana/otel-lgtm/[Grafana LGTM] has been added using the `grafana/otel-lgtm` container image.



=== Testcontainers Improvements



==== Grafana LGTM
`org.testcontainers.grafana.LgtmStackContainer` is now supported.



=== Image Building Improvements
An `imagePlatform` option has been added to the Maven and Gradle plugins for building OCI images.
This option can be used to specify the operating system and architecture of any CNB builder, run, and buildpack images that are pulled in order to run CNB buildpacks. 
This can be used to build an image for an operating system and architecture that is different from the OS/architecture of the host platform, when the host platform supports emulation of the other OS/architecture (for example, when using Rosetta on a Mac with Apple silicon to emulate the AMD archicture on an ARM host). 
See the {maven-docs}/build-image.html#build-image.customization[Maven] or {gradle-docs}/packaging-oci-image.html#build-image.customization[Gradle] documentation for more information. 



=== Couchbase Authentication
Client certificates can now be used to authenticate with a Couchbase cluster, as an alternative to basic username and password authentication. See the {reference-docs}/data/nosql.html#data.nosql.couchbase[reference documentation] for more details. 



=== Configuration Metadata
The default value of an `Enum` is now detected by the annotation processor.
If you have added manual metadata to provide the value for a custom property, make sure to remove it.



=== FreeMarker
FreeMarker variables that are used by the auto-configured FreeMarker's `Configuration` object can now be customized.
To do so, define one or more beans of type `FreeMarkerVariablesCustomizer`.
These are invoked according to their defined order (if any).



=== Spring Pulsar
Configuration properties are now provided for configuring a default tenant and namespace.
The defaults apply when consuming or producing messages with a topic URL that is not fully qualified.
Configure them using the `spring.pulsar.defaults.topic.tenant` and `spring.pulsar.defaults.topic.namespace` configuration properties or define your own `PulsarTopicBuilder` bean.
Set `spring.pulsar.defaults.topic.enabled=false` to disable the defaults.



=== Pluggable Actuator Exposers
It is now possible to extend Spring Boot to expose actuator endpoints in a pluggable way.
The new `EndpointExposureOutcomeContributor` interface can be implemented to influence `@ConditionalOnAvailableEndpoint` conditions.

This extension should make it easier to offer additional platform integrations similar to our existing Cloud Foundry support.



=== Dependency Upgrades
Spring Boot 3.4.0-M2 moves to new versions of several Spring projects:

* Spring AMQP 3.2.0-M2
* Spring Authorization Server 1.4.0-M1
* Spring Framework 6.2.0-M7
* Spring Integration 6.4.0-M2
* Spring Kafka 3.3.0-M2
* Spring Pulsar 1.2.0-M1
* Spring Security 6.4.0-M3
* Spring Session 3.4.0-M2

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

* Flyway 10.17
* Hibernate 6.6
* JUnit Jupiter 5.11
* Kafka 3.8
* Liquibase 4.29
* Micrometer 1.4.0-M2
* Micrometer Tracing 1.4.0-M2
* OpenTelemetry 1.41
* Reactor 2024.0.0-M5
* Testcontainers 1.20



=== Miscellaneous
Apart from the changes listed above, there have also been lots of minor tweaks and improvements including:

* `@Name` can now be used on the field of a JavaBean-style configuration property to customize its name.
* When derived from another `DataSource`, `DataSourceBuilder` can now determine the Driver class name using the source DataSource's URL if it does not expose the Driver class name.
* https://docs.spring.io/spring-boot/3.4-SNAPSHOT/reference/actuator/endpoints.html#actuator.endpoints.kubernetes-probes[Liveness and Readiness health probes] are now automatically enabled on Cloud Foundry Platforms.
* The new property `spring.application.version` can be used to read and set the application version. The default value for the property is taken from the `Implementation-Version` of the manifest.
* Docker Compose now supports multiple Docker Compose configuration files.
* The auto-configured `EntityManagerFactoryBuilder` defines the native (e.g. Hibernate) properties as well.
* Spring Integration's `TaskScheduler` is now virtual thread aware, even if `@EnableScheduling` hasn't been used.
* The banner is now automatically disabled if using console structured logging.
* `@ConditionalOnAvailableEndpoint` now has a `value` alais for `endpoint`.



== Deprecations in Spring Boot 3.4.0-M2

* `org.springframework.boot.ResourceBanner#getApplicationVersion(Class<?>)` in favor of `spring.application.version` property.
* `org.springframework.boot.SpringApplication#logStartupInfo(boolean)` in favor of `org.springframework.boot.SpringApplication#logStartupInfo(ConfigurationApplicationContext)`.
* `org.springframework.boot.logging.logback.ApplicationNameConverter` in favor of `org.springframework.boot.logging.logback.EnclosedInSquareBracketsConverter`.
* `org.springframework.boot.actuate.autoconfigure.endpoint.expose.EndpointExposure#CLOUD_FOUNDRY` in favor of `org.springframework.boot.actuate.autoconfigure.endpoint.expose.EndpointExposure#WEB`.
