Sunday, February 2, 2014

New Features in Spring Framework 4.0:

New Features in Spring Framework 4.0:

The Spring 4.0 is the latest major release of Spring framework which the support for Java 8, JEE 7, REST WebServices and HTML 5 supports.
  • Removed Deprecated Packages and Methods - In Spring Framework 4.0 all deprecated packages, classes and methods have been removed.
  • Java 8 support - Spring Framework 4.0 provides support for several Java 8 features such as expression of callbacks using lambdas, JSR 310 Date and Time API, and parameter name discovery.
    • Auto-wiring based on generic types.
    • @Description annotation has been added.
    • @Conditional annotation is introduced that can conditionally filter the beans.
    • @Ordered annotation and Ordered interface are supported for ordering the Beans.
    • Now programmers can write custom annotations that expose specific attributes from the source annotation.
    • The @Lazy annotation can now be used on injection points, as well as on @Bean definitions.
    • CGLIB-based proxy classes no longer require a default constructor. Support is provided via the objenesis library which is repackaged inline and distributed as part of the Spring Framework. With this strategy, no constructor at all is being invoked for proxy instances anymore.
  • General Web Improvements - The following general improvements have been made to Spring’s Web modules:
  • WebSocket, SockJS, and STOMP Messaging
    • A new spring-websocket module provides comprehensive support for WebSocket-based, two-way communication between client and server in web applications. It is compatible with JSR-356, the Java WebSocket API, and in addition provides SockJS-based fallback options (i.e. WebSocket emulation).
    • A new spring-messaging module adds support for STOMP as the WebSocket subprotocol to use in applications along with an annotation programming model for routing and processing STOMP messages from WebSocket clients. As a result an @Controller can now contain both @RequestMapping and @MessageMapping methods for handling HTTP requests and messages from WebSocket-connected clients.
  • Testing Improvements -
    • Almost all annotations in the spring-test module (e.g., @ContextConfiguration, @WebAppConfiguration, @ContextHierarchy, @ActiveProfiles, etc.) can now be used as meta-annotations to create custom composed annotations and reduce configuration duplication across a test suite.
    • Active bean definition profiles can now be resolved programmatically, simply by implementing a custom ActiveProfilesResolver and registering it via the resolver attribute of @ActiveProfiles.

0 comments: