The Spring Framework 4.0 GA release on December 12, 2013 is the first major Spring Framework release in almost four years, and it will set the stage for modern development practices in the Java community. Over the past decade, the open-source Spring Framework has become the dominant programming model in Java because it simplifies complex enterprise applications. Best of all, the framework is open source. This means that Spring 4.0 is available to anyone via a free license and that anyone can contribute software improvements to the framework.
Here are some of the new features and key enhancements that we’re excited about:
Support for Java 8, Lambda expressions, and Date/Time features
Java 8 will finally be supporting Lambda expressions with the new version tentatively scheduled for release on March 18, 2014! The goals of these expressions are to simplify code and get rid of repeating code. But what does that really mean? This means that a lambda is an unnamed inline function can be used to replace an anonymous inner class with fewer lines of code and in a more readable format. We think the biggest practical use for developers will be to get rid of repeating loops when working with collections for certain match criteria. More important than its practical use is that Lambda expressions help to make Java competitive in the wake of popular functional languages such as Scala or Clojure.
Java has a poor reputation with its native date and time libraries, and therefore many developers have turned to use third-party libraries such as Joda Time. Thus, the new JSR 310 date/time features are a welcome addition for us! We foresee the new date/time features in Java 8 being tremendously useful for clients with business requirements around time series data.
Enhanced REST support
Developing REST APIs is now easier in Spring with new API enhancements. Specifically, Spring added a new @RestController annotation as a convenience. In previous versions, you had to use the generic @Controller annotation and @ResponseBody annotation. We think simplicity such as this will encourage more developers to use Spring REST rather than other popular options such as Apache CXF.
WebSocket support using STOMP
The WebSocket Protocol defines two-way messaging over HTTP between client/server and Spring now provides support for this architectural-style using STOMP (Simple Text Oriented Messaging Protocol). Most of today’s web applications aren’t programming directly to sockets. However, we think Spring’s implementation of STOMP could potentially benefit clients with real-time and guaranteed delivery requirements. Practical uses could be in real-time trading applications and financial market data applications. We also think that WebSockets will be a growing trend with web applications the in the coming years, especially in the financial industry.
Enhanced Groovy support
One of the cool features of Spring is the domain-specific language (DSL) support it provides. Groovy is one DSL that is popular in the Java community as it can easily be compiled as JVM bytecode. Groovy’s web framework (Grails) has a “Bean Builder” that can be used as an alternative to Spring’s usual bean definitions in XML or Java. We see this as a benefit because it will allow you to wire together dependencies at runtime. We’re hoping this helps to get away from environment specific property files and duplicate code.
Release of Spring Boot
Spring Boot is probably the most exciting part of the new Spring release for us! At a high-level, Spring Boot is meant to make developers instantly productive like light-weight frameworks such as Ruby on Rails. So how does Spring Boot accomplish this? First, it provides pre-configured POM files to assist your initial project configuration. Second, it essentially eliminates all other configuration work and has no requirements for XML configuration. Lastly, it provides built-in support for security, metrics, and health checks to help make applications production-ready. We took Spring Boot for a test drive and had a “Hello World” web application deployed in less than a minute. The thing that we like best about the future prospects of Spring Boot is that it’s Dev-Ops friendly and will allow developers to focus more on building business features and less on infrastructure. Ultimately, we think this can drive business value for our clients.
These features and projects help make the Spring Framework the leading open source platform for modern enterprise Java applications and cutting-edge development practices. Now is a great time to learn more about Spring and the spring.io website is a great place to start.