BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Updated Spring 5.0 Roadmap and Reactive Story Presented at SpringOne

Updated Spring 5.0 Roadmap and Reactive Story Presented at SpringOne

This item in japanese

On the second day of the SpringOne Platform conference in Las Vegas, project lead Juergen Hoeller gave an update to attendees on the Spring framework roadmap.

Spring 4.0 Pivotal has shortened iterations for the Spring framework with a major feature release about every 9-10 months. Version 4.3 was released in July of this year, and is expected to be the last 4.x feature release. It introduces further refinements to the core dependency injection framework itself, as well as to Spring MVC, the web layer. The system requirements are unchanged so the release is compatible with JDK 6,7 and 8 and runs on any Servlet 2.5+ container.

Spring Framework 5.0 is also progressing with the first milestone release coming out in July of this year, and a release candidate expected around December. A GA release will then follow around Q1 2017. Spring 5.0 will see a major baseline update requiring JDK 8+, Servlet 3.1+, JMS 2.0+, JPA 2.1+ and JUnit 5.

The marquee feature for the new release will be first class support for Reactive web applications, derived from work done in Project Reactor which has itself been developed in close collaboration with the RxJava lead.

Reactive programming is about non-blocking, event-driven applications that scale with a small number of threads with back-pressure - a feedback mechanism that aims to ensure producers do not overwhelm consumers. The Reactive Streams specification, adopted for both 9 and Spring 5, enables the ability to communicate demand across layers and libraries from different providers.

For Spring 5, a new Spring Web Reactive web framework is being added as an alternative to Spring Web MVC. Spring Web Reactive supports the @Controller programming model, and also provides a reactive Web Client. It has a very similar look and feel to Spring MVC, but adds new contracts with non-blocking semantics which are built on top of Reactive Streams and Reactor. These will consume the request, and write to the response, using a non-blocking reactive style API, allowing you, for example, to write to the HttpSocket with back-preasure.

The code sample below, taken from a blog post that introduces Reactive Programming with Spring 5.0 M1, is a controller that obtains and streams data from a remote server in a completely non-blocking and reactive manner:

@GetMapping("/accounts/{id}/alerts")
public Flux getAccountAlerts(@PathVariable Long id) {

  return this.repository.getAccount(id)
      .flatMap(account ->
          this.webClient
              .perform(get("/alerts/{key}", account.getKey()))
              .extract(bodyStream(Alert.class)));
}

Aside from reactive support, the Spring core container team will be focussing on start-up performance, in particular looking at using multiple threads for bootstrapping in environments where that is possible. During his keynote, Hoeller explained:

The core container really does a lot of work when just bootstrapping your application. To some degree this already quite optimised, however at the moment we just do the best possible job given the information that we have at runtime. And the information is often just a JAR file - basically a class path…

In 5.0 we are going to explore the use of additional facilities. What if the build process would create a specifically crafted index for us that allows us to find out about specific annotated components upfront, without having to fully scan the classpath? What about concurrent bootstrapping? What if certain start-up processes in environments that allow us to use additional bootstrap threads would just run concurrently?

Version 5.0 will also see a core container overhaul with Java 8 enabled APIs in the core framework, for example making use of java.util.function types. Programmatic endpoint management is also planned with alternatives to annotated handler methods, and lambda-oriented HTTP routing and processing. The framework will also support HTTP/2 on both the client and server side.

Spring framework 5.0 was planned to be released in concert with JDK 9, and at the time of writing Spring framework 5.0 M1 will run correctly using the current JDK 9 snapshot at least in classpath mode. The first milestone doesn’t however work with module path, the new “Jigsaw” modularity system, but support for this is expected in a subsequent milestone release.

Given that further delays are now expected for JDK 9.0, Spring 5.0 will ship independently when the team considers it ready, Hoeller told the conference, with the intention that Spring framework 5.1 will be the one to fully embrace JDK 9. Spring 5.1 is expected to appear towards the end of 2017.

Rate this Article

Adoption
Style

BT