What Is New in Spring Boot 2.0
Spring Boot 2.0 is a major release that builds on Spring Framework 5.0 and requires Java 8 as a minimum. It represents a significant upgrade with a focus on reactive programming, developer experience, and new technology support.
| Category | Key Changes |
|---|---|
| New Features | Reactive web support, Java 9 compatibility, new actuator endpoints, Kotlin support |
| Improvements | Configuration property overhaul, embedded server updates, Micrometer metrics |
| Deprecated | Legacy actuator endpoints, some security configurations, old property names |
| Breaking Changes | Java 8 baseline, configuration property binding rules, HikariCP as default pool |
How did configuration handling change?
Configuration property binding got a major overhaul for stricter and more reliable behavior. The new @ConfigurationProperties binding is now based on constructor parameters, which enforces immutability and prevents accidental changes to bound objects.
Relaxed binding rules were introduced, allowing properties to be specified in various case styles like kebab-case, camelCase, or snake_case. This matters because it gives developers flexibility while maintaining a consistent internal representation.
Many legacy property names were replaced with a new unified namespace. You'll need to update properties like server.context-path to server.servlet.context-path in your application.properties files.
What reactive programming support was added?
Spring Boot 2.0 introduced first-class support for reactive applications through Spring WebFlux. This includes auto-configuration for both Netty and Reactor Netty as embedded servers, which are essential for non-blocking applications.
The new actuator endpoints work seamlessly with reactive applications, providing health checks, metrics, and environment details without blocking. In practice, this means you can build fully reactive microservices with monitoring capabilities out of the box.
Reactive Spring Data support was integrated for MongoDB, Cassandra, and Redis. This allows end-to-end reactive stacks where everything from the HTTP layer to database operations operates non-blocking.
How was metrics and monitoring improved?
Metrics collection was completely redesigned using Micrometer, which provides a vendor-neutral interface for application metrics. This replaced the previous metrics system that was specific to Spring Boot.
The actuator endpoints were reworked with a new /actuator base path and JSON format. Key endpoints like /actuator/health now provide more detailed information while /actuator/info displays arbitrary application info.
In practice, this means you can integrate with monitoring systems like Prometheus, Datadog, or New Relic without custom adapters. The metrics system automatically provides JVM metrics, HTTP request timing, and database connection pool statistics.
What database and connection pool changes occurred?
HikariCP became the default connection pool instead of Tomcat JDBC due to its superior performance and reliability. This change happens automatically when you include the spring-boot-starter-jdbc dependency.
Database initialization logic was enhanced with improved detection of embedded databases. Spring Boot 2.0 can better distinguish between embedded and external databases, preventing accidental data loss during development.
JDBC URL generation for embedded databases changed to include a random suffix by default. This prevents conflicts when running multiple applications simultaneously during testing.
What security enhancements were implemented?
The security auto-configuration was updated to align with Spring Security 5.0, which includes OAuth 2.0 client support and improved password encoding. The default security configuration now generates a single user with a printed password during startup.
CSRF protection was enabled by default for actuator endpoints when Spring Security is present. This provides better security out of the box but might require adjustments if you're accessing endpoints from non-browser clients.
Content Security Policy headers were added to the default security configuration to help prevent XSS attacks. In practice, you might need to customize these policies for applications that use specific JavaScript frameworks.
FAQ
Is Java 8 required for Spring Boot 2.0?
Yes, Java 8 is the minimum requirement. This enables the use of lambda expressions, streams, and other modern Java features throughout the framework.
Why did my configuration properties stop working?
Many property names were changed to a new unified namespace. For example, server.context-path became server.servlet.context-path. Check the migration guide for the complete list of changes.
How do I migrate from Spring Boot 1.5 to 2.0?
Start by updating your Java version to 8+, then address deprecated features and property changes. The most impactful changes are usually the configuration properties and actuator endpoint updates.
What happened to the old actuator endpoints?
Most legacy endpoints were replaced with new ones under the /actuator path. The JSON response format also changed to be more structured and consistent across endpoints.
Can I still use Tomcat JDBC connection pool?
Yes, but you need to explicitly exclude HikariCP and include Tomcat JDBC in your dependencies. HikariCP is now the default due to its better performance characteristics.