Following are the Spring 4 New Features and Enhancement:-
1. Java 8 Support : Spring 4 Framework supports java lambda expression. The java.time package of java 8 is supported efficiently. Spring 4 supports minimum JDK 6 or upper version of java.
2. Servlet 3.0 is Strongly Recommended Spring 4: Java EE version 6 and 7 is the base of spring 4 which is based on JPA 2 and Servlet 3.0.
3. Hibernate 4.3 Support: Hibernate 4.3 is only supported by Spring 4.
Generic types as a form of qualifier: In spring 4, generic types can be considered as a form of qualifier. You can autowire:
4. Spring 4 supports to develop custom annotation
5. If we autowire list and arrays, then bean containing in these collection can be ordered.
6. In spring 4, @Lazy annotation can be used at injection label too.
7. For REST application, spring 4 provides new @RestController annotation. Before this, each rest web service method need to be annotated with @ResponseBody. Now if you use @RestController at class level then we do not need to use @ResponseBody.
8. In spring 4, AsyncRestTemplate class has been added for REST development.
9. In Spring 4 MVC, different time zone has been supported.
10. New modules has been added
a. spring-websocket : Helps the two way communication between client and server.
b. spring-messaging: This modules supports STOMP.
11. In spring-test, now in spring 4, all annotations can be used to create custom composed annotations.
12. In spring- test, custom ActiveProfilesResolver , can be implemented to resolve active bean definitions programmatically.
13. A class SocketUtils has been introduced to get TCP and UDP server port.
14. All the mocks org.springframework.mock.web is based on Servlet 3.0 in spring 4.