What Is New in Spring Boot 2.1
Spring Boot 2.1 introduces a significant refresh, aligning with Spring Framework 5.1 and delivering a host of new features and refinements. This release focuses on developer productivity, runtime efficiency, and enhanced support for reactive programming and Java 11.
| Category | Key Changes |
|---|---|
| New Features | Third-party library upgrades, support for Java 11, HikariCP as default connection pool, OAuth 2.0 client support. |
| Improvements | Enhanced metrics with Micrometer, refined Actuator endpoints, property changes for overriding, relaxed binding for collections. |
| Deprecations | Legacy Spring Security OAuth support, certain properties and methods marked for removal in future versions. |
How did third-party library support change?
The core of this release is a major version bump for numerous foundational dependencies. This keeps the ecosystem current and allows developers to leverage the latest features from the broader Java community.
Key upgrades include Spring Framework 5.1, Tomcat 9, Hibernate 5.3, and Gradle 4.10. In practice, this means better performance, new APIs, and improved compatibility with modern JDKs out of the box.
What about Java version compatibility?
Spring Boot 2.1 fully supports Java 11 as its next Long-Term Support (LTS) release, while maintaining compatibility with Java 8. This matters because it gives teams a clear, supported path to migrate from Java 8 to Java 11.
The build also supports JDK 12 for early experimentation, though Java 8 and 11 remain the primary targets for production deployment.
How is database connection pooling handled now?
HikariCP is now the default connection pool for auto-configured DataSources, replacing the older Tomcat JDBC pool. This switch is a big win for most applications as HikariCP is renowned for its high performance and low overhead.
You can revert to the Tomcat pool by setting the spring.datasource.type property if you have specific tuning requirements, but for most, the new default is a straightforward performance boost.
What's new with application properties?
Configuration has become more flexible and powerful. A key change is the ability to override any property from the command line using an environment variable, not just those starting with spring..
Relaxed binding rules were also extended to @ConfigurationProperties that support collections. You can now use a much wider range of formats in your application.properties file, like lists with comma-separated values or YAML-style lists.
# Example of new list binding
my.app.servers=first.example.com,second.example.com
my.app.servers[0]=first.example.com
my.app.servers[1]=second.example.com
How did metrics and monitoring evolve?
Integration with Micrometer, the application metrics facade, was deepened. All actuator metrics are now based on Micrometer, providing a consistent and powerful way to export metrics to various monitoring systems like Prometheus, Datadog, and InfluxDB.
The info and health endpoints were refined for better clarity and customization. The health endpoint now groups details by component, making it easier to parse and understand the status of complex systems.
FAQ
I'm on Java 8. Do I have to upgrade to Java 11 to use Spring Boot 2.1?
No, Java 8 is still fully supported. This release provides a supported path for those ready to move to Java 11 but does not force the upgrade.
My app used the Tomcat JDBC connection pool. Will it break with HikariCP?
It should work seamlessly. The switch is transparent for most use cases. If you encounter pool-specific configuration issues, you can explicitly set spring.datasource.type=org.apache.tomcat.jdbc.pool.DataSource to revert.
What happened to Spring Security OAuth support?
The legacy Spring Security OAuth project is deprecated. For OAuth 2.0 client support, use the new first-class features provided by Spring Security 5.1. For authorization server support, the community is directed toward other projects.
Can I override any property from an environment variable now?
Yes. Previously, only properties with names starting with "spring." could be overridden this way. Now, any property can be overridden from the command line using an environment variable, which is much more flexible.
How do the new collection binding rules help me?
They make writing lists and arrays in application.properties less error-prone and more intuitive. You're no longer locked into a single syntax, which simplifies configuration, especially when copying values between YAML and properties files.