:boot-docs: https://docs.spring.io/spring-boot/4.1-SNAPSHOT
:framework-docs: https://docs.spring.io/spring-framework/reference/7.0.x-SNAPSHOT
:framework-api-docs: https://docs.spring.io/spring-framework/docs/7.0.x-SNAPSHOT/javadoc-api/org/springframework

= Spring Boot 4.1.0-M2 Release Notes

For changes in earlier milestones, please refer to:

- link:Spring-Boot-4.1.0-M1-Release-Notes[v4.1.0-M1]



== Upgrading from Spring Boot 4.0



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


=== Specify the Encoding When Importing Configuration Files

When `spring.config.import` is used, it's now possible to specify the encoding. In the past, property files always have been loaded with the ISO-8859-1 encoding (which is still the default). To load them using a different encoding, you can use this syntax:

```properties
spring.config.import=classpath:import.properties[encoding=utf-8]
```



=== Info Endpoint
The info endpoint now provides additional information about the process.
The following fields are now available in the endpoint's response:

- `process.uptime`
- `process.startTime`
- `process.currentTime`
- `process.timezone`
- `process.locale`
- `process.workingDirectory`

Refer to the {boot-docs}/api/rest/actuator/info.html#info.retrieving.response-structure.process[endpoint's API documentation] for further details.



=== Jackson Factory Configuration and Customization
Jackson uses factories to create its readers and writers.
These factories can now be configured using various `spring.jackson.factory` properties to fine tune Jackson's read and write constraints.

Additionally, for more advanced customization various customizer callbacks are now supported:

- `JsonFactoryBuilderCustomizer` for customization of the `JsonFactoryBuilder` used by the auto-configured `JsonMapper`
- `CborFactoryBuilderCustomizer` for customization of the `CBORFactoryBuilder` used by the auto-configured `CBORMapper`
- `XmlFactoryBuilderCustomizer` for customization of the `XmlFactoryBuilder` used by the auto-configured `XmlMapper`



=== Service Connections to RabbitMQ Streams
Service connections to RabbitMQ Streams are now supported with both Testcontainers and Docker Compose.

When using Testcontainers, a service connection can be made using `@ServiceConnection(type = RabbitStreamConnectionDetails.class)`.
The `rabbitmq_stream` plugin must also be enabled in the container as shown in the following example:

[source,java]
----
private static RabbitMQContainer createRabbitMqStreamContainer() {
	RabbitMQContainer container = TestImage.container(RabbitMQContainer.class);
	container.addExposedPorts(RABBITMQ_STREAMS_PORT);
	String enabledPlugins = "[rabbitmq_stream].";
	container.withCopyToContainer(Transferable.of(enabledPlugins), "/etc/rabbitmq/enabled_plugins");
	return container;
}
----

When using Docker Compose, the RabbitMQ service must map container port 5552.
As with Testcontainers, the `rabbitmq_stream` plugin must also be enabled as shown in the following example:

[source,yaml]
----
services:
  rabbitmq:
    image: '{imageName}'
    environment:
      - 'RABBITMQ_DEFAULT_USER=myuser'
      - 'RABBITMQ_DEFAULT_PASS=secret'
    configs:
      - source: plugins
        target: /etc/rabbitmq/enabled_plugins
    ports:
      - '5552'
configs:
  plugins:
    content: "[rabbitmq_stream]."
----



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

* https://github.com/micrometer-metrics/micrometer/releases/tag/v1.17.0-M2[Micrometer 1.17.0-M2]
* https://github.com/micrometer-metrics/tracing/releases/tag/v1.7.0-M3[Micrometer Tracing 1.7.0-M3]
* https://github.com/spring-projects/spring-amqp/releases/tag/v4.1.0-M2[Spring AMQP 4.1.0-M2]
* https://github.com/spring-projects/spring-data-bom/releases/tag/2026.0.0-M1[Spring Data 2026.0.0-M1]
* https://github.com/spring-projects/spring-kafka/releases/tag/v4.1.0-M1[Spring Kafka 4.1.0-M1]
* https://github.com/spring-projects/spring-integration/releases/tag/v7.1.0-M2[Spring Integration 7.1.0-M2]
* https://github.com/spring-projects/spring-security/releases/tag/7.1.0-M2[Spring Security 7.1.0-M2]
* https://github.com/spring-projects/spring-session/releases/tag/4.1.0-M1[Spring Session 4.1.0-M1]

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

* https://activemq.apache.org/components/artemis/download/release-notes-2.51.0[Artemis 2.51.0]
* https://commons.apache.org/proper/commons-codec/changes.html#a1.21.0[Commons Codec 1.21.0]
* https://docs.couchbase.com/java-sdk/current/project-docs/sdk-release-notes.html[Couchbase Client 3.11.0]
* https://documentation.red-gate.com/flyway/release-notes-and-older-versions/release-notes-for-flyway-engine[Flyway 12.0.1]
* https://github.com/redis/jedis/releases/tag/v7.2.1[Jedis 7.2.1]
* https://github.com/JetBrains/kotlin/releases/tag/v2.3.10[Kotlin 2.3.10]
* https://github.com/redis/lettuce/releases/tag/7.2.1.RELEASE[Lettuce 7.2.1.RELEASE]
* https://github.com/apache/maven-compiler-plugin/releases/tag/maven-compiler-plugin-3.15.0[Maven Compiler Plugin 3.15.0]
* https://github.com/apache/maven-dependency-plugin/releases/tag/maven-dependency-plugin-3.10.0[Maven Dependency Plugin 3.10.0]
* https://dev.mysql.com/doc/relnotes/connector-j/en/news-9-6-0.html[MySQL 9.6.0]
* https://github.com/open-telemetry/opentelemetry-java/releases/tag/v1.58.0[OpenTelemetry 1.58.0]
* https://github.com/prometheus/client_java/releases/tag/v1.5.0[Prometheus Client 1.5.0]
* https://github.com/mariadb-corporation/mariadb-connector-r2dbc/releases/tag/1.4.0[R2DBC MariaDB 1.4.0]



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

* Customizers for `OtlpHttpLogRecordExporterBuilder` and `OtlpGrpcLogRecordExporterBuilder` have been added.
* Additional mime types that should be compressed when sending HTTP responses can be configured using `server.compression.additional-mime-types`
* Kotlin extensions for `TestEntityManager` have been added.
* The actuator info endpoint now returns certificates from the truststore, too.
* Value objects now bind `Optional` parameters as `Optional.empty()` rather than `null`. This applies to any `@ConfigurationProperties` that use constructor binding.
* Compression can now be used when exporting metrics over OTLP.
  To enable compression set `management.otlp.metrics.export.compression-mode` to `gzip`.
* `publishMaxGaugeForHistograms` can be configured on the `OTLPRegistry`.


== Deprecations in Spring Boot 4.1.0-M2

* Properties and classes for configuring the Dynatrace V1 API, in favor of using the V2 API
