Spring Boot 2.0 is just around the corner, but what is actually new in Spring Boot 2.0? As expected, it comes with new features and improvements, and in this article, I will try to summarize the key parts of the release.
New in Spring Boot 2 is that Java 9 is officially supported, which is something that I’ve looked forward to a lot personally. The minimum required JDK is now Java 8, which means that you can not run Spring Boot 2.0.0 with JDK 7 or older.
Spring Framework 5.0 now comes packaged with Spring Boot. A couple of interesting features in Spring Framework 5.0 includes:
@Nullable
and @NotNull
annotations to deal with NullPointerExceptions at compile time rather than runtime.java.util.logging
without any extra dependencies.WebClient
implementation of a REST endpoint using the reactive stack web framework could look like this.
Mono person = webClient.get()
.uri("http://localhost:8080/movie/42")
.accept(MediaType.APPLICATION_JSON)
.exchange()
.then(response -> response.bodyToMono(Movie.class));
WebTestClient
, which similar as MockMvc does not require running the server. Instead it relies on mocking the requests and responses. The WebTestClient
can bind to the infrastructure of WebFlux.
Not officially part of Spring Boot, but still worth to mention as it plays nicely with Spring Framework 5.0. Spring Security version was updated to 5.0 and comes with over 400+ enhancements and bug fixes. The highlights of the release are the following new features.
Important to consider when migrating from Spring Boot 1.x to 2.x is that the annotation @ConditionalOnBean annotation now uses logical AND instead of logical OR for combining conditions.
Also new in Spring boot 2.0 is that Thymeleaf 3 is now officially supported which is an update to both Thymeleaf and Spring Security Thymeleaf dependencies. Some noticeable changes in Thymeleaf 3 are listed below.
[# th:each="item : ${items}"]
- [# th:utext="${item}" /]
[/]
Spring Boot 2.0 is a released packed with great stuff. I believe the main arguments for upgrading are:
If you benefit from any of this three things, then you should definitely consider upgrading. And also, do not forget, that the release also includes a lot of bug fixes and performance improvements which alone makes a strong case for upgrading.
Streams has become a very popular way to process a collection of elements. But a…
A lot of focus on my previous blogs has been on how to build micro…
Learn how to work with high-quality reference genomes in this article by Tiago Antao, a…
Garbage collection is one of the key concepts of Java programming and up to now…
Learn about convolution in this article by Sandipan Dey, a data scientist with a wide…
Lombok comes with a very convenient way of creating immutable objects with the builder pattern.…