Spring Boot 2.0 is out: What’s new and noteworthy
© Shutterstock / Vjom
After 17 months of hard work and over 6800 commits by 215 different individuals, Spring Boot 2.0 is finally here. Let’s see what’s new and noteworthy — and yes, Java 9 support is part of the deal.
Today is a good day but not because spring has arrived — in theory, at least—. Spring Boot 2.0 is here!
Since this is a major release, upgrading existing applications might not be a breeze, which is why the team has put together a dedicated migration guide to help you upgrade your existing Spring Boot 1.5 applications.
However, if you’re using an earlier version of Spring Boot, you are advised to upgrade to Spring Boot 1.5 before migrating to Spring Boot 2.0.
What’s so special about Spring Boot 2.0?
Spring Boot 2.0 is the first major revision of Spring Boot since 1.0 was released nearly years ago and it’s also the first GA version of Spring Boot that provides support for Spring Framework 5.0, Pivotal’s Phil Webb wrote in a recent blog post announcing the release.
- Java 8 baseline, and Java 9 support. In short, what you should know is that Spring Boot 2.0 requires Java 8 as a minimum version. Furthermore, a lot of existing APIs have been updated to take advantage of Java 8 features (including default methods on interfaces, functional callbacks, and new APIs such as
javax.time). If you aren’t using Java 8 yet, you should upgrade your JDK before you decide to develop Spring Boot 2.0 applications. The newest Spring Boot version has also been tested with JDK 9 so it’s good to go. All the jars ship with automatic module name entries in the manifests for module system compatibility.
- Reactive web programming support with Spring WebFlux/WebFlux.fn. Spring Boot provides auto-configuration for both annotation based Spring WebFlux applications, as well as WebFlux.fn which offers a more functional style API.
- Auto-configuration and starter POMs for reactive Spring Data Cassandra, MongoDB, Couchbase, and Redis.
- Reactive Spring. A lot of projects in the Spring portfolio are currently offering first-class support for developing reactive applications. Reactive applications (which are now fully asynchronous and non-blocking) are intended for use in an event-loop execution model (instead of the more traditional one thread-per-request execution model). Spring Boot 2.0 fully supports reactive applications via auto-configuration and starter-POMs. The internals of Spring Boot itself have also been updated where necessary to offer reactive alernatives (the most noticeable being the embedded server support).
- Support for embedded Netty. WebFlux does not rely on Servlet APIs but the good news is that support for Netty is offered as an embedded server for the first time. The
spring-boot-starter-webfluxstarter POM will pull-in Netty 4.1 and Ractor Netty.
- HTTP/2 is now provided for Tomcat, Undertow, and Jetty. However, keep in mind that support depends on the chosen web server and the application environment.
- Spring Boot’s Gradle plugin has been largely rewritten so now it enables a number of significant improvements. However, you should know that Spring Boot now requires Gradle 4.x so check the migration guide if you’re upgrading a project that uses Gradle.
- The latest Spring Boot release also includes support for Kotlin 1.2.x and offers a
runApplicationfunction which provides a way to run a Spring Boot application using idiomatic Kotlin.
- Spring Boot 2.0 now detects the jOOQ dialect automatically based on the DataSource (similarly to what is done for the JPA dialect). A new
@JooqTestannotation has also been introduced to ease testing where only jOOQ has to be used.
- Spring Boot now auto-configures the open-source time series database InfluxDB. To enable InfluxDB support you’ll have to set a
spring.influx.urlproperty, and include
influxdb-javaon your classpath.
Head over to the release notes page find out more about everything that has been included in Spring Boot 2.0. More details about some Spring Boot 2.0 features should be published over the next couple of weeks.