Spring Framework 6.2 Release Notes
Spring Framework 6.2.0 delivers key enhancements in bean management, testing, and expression language capabilities while aligning with Jakarta EE 10 and Java 17+. This version builds on Spring 6.1 with over 200 improvements, focusing on developer productivity and performance. It integrates seamlessly with Spring Boot 3.4.0 and supports virtual threads from Java 21.
Spring Framework 6.2 maintains backward compatibility for most Spring 6.x applications, with refined auto-configuration and better observability. It is suitable for web applications, microservices, and enterprise systems, emphasizing streamlined upgrades and reduced boilerplate.
Support for Fallback Beans
Introduced @Fallback annotation for defining fallback beans that activate when primary beans are unavailable. This simplifies error handling in dynamic environments like cloud deployments.
Configure with @Bean @Fallback on methods, allowing conditional activation based on exceptions or availability checks.
Background Bean Initialization
Enabled background initialization for non-critical beans, reducing startup time. Set spring.main.lazy-initialization=true combined with @Lazy for selective lazy loading.
This feature prioritizes essential beans during context refresh, deferring others to runtime, ideal for large applications.
AssertJ Integration
Added official support for AssertJ in testing utilities, including AssertJCondition for advanced assertions in @Conditional checks.
This brings fluent, readable assertions to Spring's testing slice, aligning with Spring Boot's existing AssertJ facilities.
SpEL Enhancements
Revised documentation for property navigation and indexing in SpEL expressions, including support for string and object indexing.
New reference section covers advanced features like safe navigation and collection projections for more expressive configurations.
Property Accessor Precedence
PropertyAccessor implementations specifying target types now take precedence over generic fallbacks like ReflectivePropertyAccessor.
This may alter evaluation order in upgrades, ensuring type-specific accessors are used first for better performance.
WebJars Resource Resolver
Deprecated WebJarsResourceResolver using org.webjars:webjars-locator-core due to efficiency issues. Superseded by LiteWebJarsResourceResolver with org.webjars:webjars-locator-lite.
This change improves resource resolution speed in web applications serving static assets from WebJars.
Performance Improvements
Bean factory optimizations reduce context refresh time by 5-10% in large configurations. SpEL evaluation is faster with cached expressions.
Testing utilities benefit from AssertJ's efficient matching, lowering overhead in integration tests.
Dependency Upgrades
| Dependency | Version |
|---|---|
| Jakarta EE | 10 |
| Micrometer | 1.13 |
| AssertJ | 3.26 |
| Hibernate | 6.5 |
| Jackson | 2.17 |
Deprecations
Deprecated legacy WebJars locator due to performance concerns. XML-based bean definitions encouraged to migrate to annotations.
Removals
Removed support for outdated property accessors. Cleaned up internal SpEL evaluators from prior versions.
Migration and Support
Upgrade from 6.1 by updating BOM in Maven/Gradle and reviewing property accessor order. Use spring-boot-migrator for assisted transitions.
Spring Framework 6.2 follows the quarterly patch cycle, with full support until November 2026 and security fixes to 2028.