Spring 4.0 released

Spring 4.0 has been released and is now available on GitHub.

Version 4.0 is the latest major release of the Spring Framework and the first to fully support Java 8 features. You can still use Spring with older versions of Java, however, the minimum requirement has now been raised to Java SE 6. [1]

The following list summarizes the new features and enhancements of the newest major release of the Spring Framework:

  • Java 8 support: You can make use of lambda expressions and method references with Spring’s callback interfaces.
  • Java EE version 6 or above is now considered the baseline for Spring Framework 4, with the JPA 2.0 and Servlet 3.0 specifications being of particular relevance.
  • Groovy Bean Definition DSL
  • WebSocket, SockJS, and STOMP Messaging
  • Improved Getting Started Experience on the new spring.io website
  • Removed all deprecated packages, and many deprecated classes and methods

Here is a simple example of using Java 8 lambda expressions as callbacks with the Spring JdbcTemplate:

JdbcTemplate jt = new JdbcTemplate(dataSource);
jt.query("SELECT name, age FROM person WHERE dep = ?",
  ps -> { ps.setString(1, "Sales"); },
  (rs, rowNum) -> new Person(rs.getString(1), rs.getInt(2))
);

[1] http://docs.spring.io/spring/docs/4.0.x/spring-framework-reference/html/new-in-4.0.html

Short URL for this post: http://wp.me/p4nxik-1Gh
This entry was posted in Spring Universe and tagged , , , , , , , , , . Bookmark the permalink.

Leave a Reply