What’s New in Spring Boot 2.6.0? Key Features and Migration Tips
Spring Boot 2.6.0 introduces major updates such as SameSite cookie support, health group configuration for main and management ports, enhanced /info endpoint with Java runtime details, WebTestClient testing, automatic spring‑rabbit‑stream setup, custom env/configprops sanitizing, new metrics, Docker build improvements, and default prohibition of circular bean references.
Important Features
1. Servlet applications support SameSite attribute in cookies
The attribute can be configured via server.session.cookie.same-site with three possible values: Strict, Lax, None (requires Secure).
2. Support configuring health groups for main and management ports
Useful in Kubernetes and other cloud environments where a separate management port is common; separate ports can cause unreliable health checks.
Previously all Actuator endpoints were placed on a single port with health groups on the main port's additional path.
3. Enhanced /info endpoint with Java Runtime information
Example JSON:
{
"java": {
"vendor": "BellSoft",
"version": "17",
"runtime": {
"name": "OpenJDK Runtime Environment",
"version": "17+35-LTS"
},
"jvm": {
"name": "OpenJDK 64-Bit Server VM",
"vendor": "BellSoft",
"version": "17+35-LTS"
}
}
}Enable or disable with management.info.java.enabled=true.
4. Support using WebTestClient to test Spring MVC
Developers can now inject WebTestClient in @AutoConfigureMockMvc classes for easier testing.
5. Add auto‑configuration for spring‑rabbit‑stream
When spring.rabbitmq.listener.type=stream, a StreamListenerContainer is auto‑configured. Stream properties can be set via spring.rabbitmq.stream.* and native listener enabled with spring.rabbitmq.listener.stream.native-listener.
6. Custom sanitizing for /env and /configprops endpoints
Allows custom sanitizing functions based on the originating PropertySource, useful for encrypted values from Spring Cloud Vault.
Other Changes
1. Reactive Session personalization
Dynamic configuration of reactive session timeout:
server.reactive.session.timeout=302. Redis connection pool auto‑configuration
When commons-pool2.jar is present, Redis connection pools are auto‑configured. Disable with:
spring.redis.jedis.pool.enabled=false
spring.redis.lettuce.pool.enabled=false3. Build information personalization
spring‑boot‑maven‑plugin can generate build-info.properties.
4. New Metrics
Application startup times:
application.started.time: time to start the application
application.ready.time: time to become ready for serviceDisk space metrics:
disk.free: free disk space
disk.total: total disk space5. Docker image build enhancements
Custom tags for images
Network configuration for Cloud Native Buildpacks
Configurable cache layer names via buildCache and launchCache
6. Removal of deprecated properties from 2.4
Many old properties have been removed; see the mappings below.
Old → New mappings:
spring.web.locale → spring.mvc.locale
spring.web.locale-resolver → spring.mvc.locale-resolver
spring.web.resources.* → spring.resources.*
management.server.base-path → management.server.servlet.context-path
7. Default prohibition of bean circular references
Circular dependencies are now disallowed by default. To re‑enable, set spring.main.allow-circular-references=true.
8. Spring MVC default path‑matching strategy
Changed from AntPathMatcher to PathPatternParser . Actuator endpoints also use PathPattern. To revert, set spring.mvc.pathmatch.matching-strategy=ant-path-matcher.
Reference
Spring Boot 2.6 is now available
Spring Boot 2.6.0 Configuration Changelog
Spring Boot 2.6.0 released (OSChina)
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Programmer DD
A tinkering programmer and author of "Spring Cloud Microservices in Action"
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
