What Is New in Spring Boot 2.2
Spring Boot 2.2 delivers a significant stack refresh and introduces several performance enhancements and developer productivity features. This release tightens integration with the broader Spring ecosystem and modern Java versions.
| Category | Key Changes |
|---|---|
| New Features | Lazy initialization, Java 13 support, RSocket integration, new actuator endpoints |
| Improvements | Faster startup, reduced memory footprint, enhanced configuration processing |
| Dependency Upgrades | Spring Framework 5.2, Spring Data Moore, Spring Security 5.2 |
| Deprecations | Selected properties and classes in preparation for future removal |
How does lazy initialization improve startup time?
Lazy initialization is a headline feature that defers bean creation until absolutely needed. This can drastically cut application startup time, especially in microservices architectures where you have many small services.
You can enable it globally with spring.main.lazy-initialization=true or use @Lazy for more granular control. In practice, this is a game-changer for development cycles but requires careful testing to avoid runtime surprises when a bean is first accessed.
What Java and framework versions are supported now?
This release aligns with the latest Spring ecosystem and Java. You get first-class support for Java 13 alongside the existing Java 8, 11, and 12.
The core framework upgrade to Spring Framework 5.2 brings its own set of reactive and functional improvements. You also get the Moore release train of Spring Data, which includes support for reactive transactions with R2DBC, and Spring Security 5.2.
Are there new ways to monitor my application?
Yes, the actuator module gets two useful new endpoints. The /actuator/env endpoint now includes a @ConfigurationProperties report showing the binding result of your configuration properties.
More importantly, the /actuator/configprops endpoint has been restructured for clarity. This makes debugging configuration issues much simpler because you can see exactly which properties are bound and where they originated.
How is RSocket integration handled?
Spring Boot now offers auto-configuration for RSocket, providing a first-class citizen for this binary protocol. You can set up RSocket servers directly and use the new RSocketRequester builder for creating clients.
This auto-configuration works seamlessly with Spring Security for authentication. It's a solid foundation for building efficient, reactive services that need capabilities beyond HTTP, like streaming or fire-and-forget messaging.
FAQ
Should I enable lazy initialization in production?
It depends on your application's profile. While it improves startup time, it can push the cost of initialization to the first request, potentially causing higher latency. Test thoroughly under load to understand the trade-offs.
Is Java 8 still supported in Spring Boot 2.2?
Yes, Java 8 remains the baseline and is fully supported. You can run Spring Boot 2.2 applications on Java 8, 11, 12, or 13 without any issues.
What is the most significant performance gain in this release?
Beyond lazy initialization, the core team focused on reducing memory footprint and optimizing the context loading process. The cumulative effect of these micro-optimizations leads to a noticeably leaner runtime.
How do I migrate my existing application to 2.2?
Start by updating the spring-boot-starter-parent version to 2.2.0.RELEASE. Review the release notes for deprecated properties and classes you might be using and replace them with the suggested alternatives.
Does the new Spring Data Moore release require code changes?
It might. The Moore release train includes non-backward-compatible changes in some modules. Pay close attention to the Spring Data release notes, especially if you're using MongoDB, Cassandra, or Redis, as there are changes in how entity types are handled.