Features of Spring Framework 4

来源:互联网 发布:淘宝店推广方案 编辑:程序博客网 时间:2024/04/29 04:02

In this article we are discussing about the new features and enhancements of the Spring Framework 4. Spring Framework 4 is the major release of the framework since 2009. New release supports Java 8 Lambda expression, new Date and Time API and the parameter name discovery. Spring 4 is fully supporting Java 8 and the Java EE 7 platform.

This version of Spring Framework (Spring 4) is the major release which is fully supporting the Java 8. Spring 4 can still be used with the older version of the Java but the minimum Java requirement is Java SE 6. In this version of Spring framework many deprecated classes and methods has been removed.

The Spring framework 4 is also upgraded to provide the supporting for the latest framework such as Hibernate ORM, Quartz framewokr, and EhCache caching solution. This release of Spring framework is supporting the development of ever growing enterprise applications.

Spring Framework 4 is the major release since 2009 as it is now re-invented to support the development of Big Data, Cloud and REST applications to meet the requirement of current applications. It is also supports Micro Service Architecture which allows the developers to develop light weight services. Spring 4 also supports all the latest JVM based innovations.

Java 8 Support

Spring 4 Framework is fully supporting the new features of Java 8. Spring 4 supports Lambda expression, new date & time API and Java 8 based parameter name discovery. Now Java 6 is the minimum requirement of JDK to run the Spring 4 based applications. Ideally you should use the Java 8 for the development of Spring 4 based application.

Secure REST stack

Now you can secure REST stack with the help of Spring 4 security stack. You can also secure Web app and Spring MVC based applications. Spring 4 security stack integrates seamlessly with REST, Spring Social, Web applications, MVC applications.

Full support for HTML5/WebSocket

Spring 4 framework fully supports HTML5 and WebSockets, with the help you Spring 4 framework you can develop applications using the features of WebSocket specifications. You can develop applications which will include the following features:

  1. Support for real-time full dupled communications over TCP
  2. Web application can use the ports 80 and 443 using the URL Schemes ws:// and wss:// respectively
  3. There will be small overhead for text messages making it more interactive for users
  4. Ping/pong frames for staying alive, which is an important feature for maintaining the session and user state

Annotation Driven programming model

Spring 4 framework supports latest annotation driven programming model which helps the developers to develop application using Custom composable annotations, annotation scoping /overriding model and the Spring expression language support.

Full support of Java EE 7 specification

Spring 4 framework fully supports Java EE 7 Specification and you can use the following features main features in your application:
1. JMS 2.0 (JSR-343)
2. JTA 1.2 (JSR-907)
3. JPA 2.1 (JSR-338)
4. Bean Validation 1.1 (JSR-349),Spring framework3支持的是jsr-303
5. JSR-236 Concurrency Utilities and many other features of JEE 7
6. JSR-356 Spring’s WebSocket endpoint mode.
7. JSR-335 Lambda expressions
8. JSR-310 Date-Time value types for Spring data binding and formatting.

Removal of Deprecated Methods and Packages

Many deprecated API’s has been removed in the Spring 4 framework. So, you should use the new API in your Spring 4 based applications. Here is the list of removed packages in Spring 4:

  1. org.springframework.core.enums
  2. org.springframework.ejb.support
  3. org.springframework.instrument.classloading.oc4j
  4. org.springframework.orm.ibatis
  5. org.springframework.orm.ibatis.support
  6. org.springframework.remoting.jaxrpc
  7. org.springframework.scheduling.backportconcurrent
  8. org.springframework.scheduling.timer
  9. org.springframework.test.context.junit38
  10. org.springframework.test.jpa
  11. org.springframework.web.servlet.view.tiles
  12. org.springframework.web.struts

Here is the list of added package in Spring 4:

  1. org.springframework.beans.factory.groovy
  2. org.springframework.cache.guava
  3. org.springframework.format.datetime.standard
  4. org.springframework.messaging
  5. org.springframework.messaging.converter
  6. org.springframework.messaging.core
  7. org.springframework.messaging.handler
  8. org.springframework.messaging.handler.annotation
  9. org.springframework.messaging.handler.annotation.support
  10. org.springframework.messaging.handler.invocation
  11. org.springframework.messaging.simp
  12. org.springframework.messaging.simp.annotation
  13. org.springframework.messaging.simp.annotation.support
  14. org.springframework.messaging.simp.broker
  15. org.springframework.messaging.simp.config
  16. org.springframework.messaging.simp.stomp
  17. org.springframework.messaging.simp.user
  18. org.springframework.messaging.support
  19. org.springframework.messaging.tcp
  20. org.springframework.messaging.tcp.reactor
  21. org.springframework.util.concurrent
  22. org.springframework.web.socket
  23. org.springframework.web.socket.adapter
  24. org.springframework.web.socket.adapter.jetty
  25. org.springframework.web.socket.adapter.standard
  26. org.springframework.web.socket.client
  27. org.springframework.web.socket.client.jetty
  28. org.springframework.web.socket.client.standard
  29. org.springframework.web.socket.config
  30. org.springframework.web.socket.config.annotation
  31. org.springframework.web.socket.handler
  32. org.springframework.web.socket.messaging
  33. org.springframework.web.socket.server
  34. org.springframework.web.socket.server.jetty
  35. org.springframework.web.socket.server.standard
  36. org.springframework.web.socket.server.support
  37. org.springframework.web.socket.sockjs
  38. org.springframework.web.socket.sockjs.frame
  39. org.springframework.web.socket.sockjs.support
  40. org.springframework.web.socket.sockjs.transport
  41. org.springframework.web.socket.sockjs.transport.handler
  42. org.springframework.web.socket.sockjs.transport.session

Here is the list of changed packages in Spring 4:

  1. org.springframework.aop
  2. org.springframework.aop.aspectj
  3. org.springframework.aop.aspectj.annotation
  4. org.springframework.aop.aspectj.autoproxy
  5. org.springframework.aop.config
  6. org.springframework.aop.framework
  7. org.springframework.aop.framework.autoproxy
  8. org.springframework.aop.framework.autoproxy.target
  9. org.springframework.aop.interceptor
  10. org.springframework.aop.support
  11. org.springframework.aop.support.annotation
  12. org.springframework.aop.target
  13. org.springframework.asm
  14. org.springframework.asm.util
  15. org.springframework.beans
  16. org.springframework.beans.factory
  17. org.springframework.beans.factory.annotation
  18. org.springframework.beans.factory.config
  19. org.springframework.beans.factory.serviceloader
  20. org.springframework.beans.factory.support
  21. org.springframework.beans.factory.xml
  22. org.springframework.beans.propertyeditors
  23. org.springframework.beans.support
  24. org.springframework.cache
  25. org.springframework.cache.concurrent
  26. org.springframework.cache.ehcache
  27. org.springframework.cache.interceptor
  28. org.springframework.cache.jcache
  29. org.springframework.cache.transaction
  30. org.springframework.cglib.transform.impl
  31. org.springframework.context.annotation
  32. org.springframework.context.event
  33. org.springframework.context.i18n
  34. org.springframework.context.support
  35. org.springframework.core
  36. org.springframework.core.annotation
  37. org.springframework.core.convert
  38. org.springframework.core.env
  39. org.springframework.core.io
  40. org.springframework.core.io.support
  41. org.springframework.core.task
  42. org.springframework.core.type
  43. org.springframework.core.type.classreading
  44. org.springframework.core.type.filter
  45. org.springframework.dao.support
  46. org.springframework.ejb.access
  47. org.springframework.expression
  48. org.springframework.expression.common
  49. org.springframework.expression.spel.ast
  50. org.springframework.expression.spel.support
  51. org.springframework.format.datetime.joda
  52. org.springframework.http
  53. org.springframework.http.client
  54. org.springframework.http.client.support
  55. org.springframework.http.converter
  56. org.springframework.http.converter.json
  57. org.springframework.http.converter.xml
  58. org.springframework.http.server
  59. org.springframework.instrument
  60. org.springframework.instrument.classloading.tomcat
  61. org.springframework.jca.cci.object
  62. org.springframework.jca.endpoint
  63. org.springframework.jca.support
  64. org.springframework.jca.work.jboss
  65. org.springframework.jdbc
  66. org.springframework.jdbc.core
  67. org.springframework.jdbc.core.metadata
  68. org.springframework.jdbc.core.namedparam
  69. org.springframework.jdbc.core.simple
  70. org.springframework.jdbc.core.support
  71. org.springframework.jdbc.datasource
  72. org.springframework.jdbc.object
  73. org.springframework.jdbc.support
  74. org.springframework.jdbc.support.lob
  75. org.springframework.jdbc.support.xml
  76. org.springframework.jms.connection
  77. org.springframework.jms.core
  78. org.springframework.jms.listener
  79. org.springframework.jms.listener.adapter
  80. org.springframework.jms.listener.endpoint
  81. org.springframework.jms.remoting
  82. org.springframework.jms.support.converter
  83. org.springframework.jmx.access
  84. org.springframework.jmx.export
  85. org.springframework.jmx.export.assembler
  86. org.springframework.jndi
  87. org.springframework.jndi.support
  88. org.springframework.mock.web
  89. org.springframework.orm
  90. org.springframework.orm.hibernate3
  91. org.springframework.orm.hibernate3.annotation
  92. org.springframework.orm.hibernate3.support
  93. org.springframework.orm.hibernate4
  94. org.springframework.orm.hibernate4.support
  95. org.springframework.orm.jdo
  96. org.springframework.orm.jdo.support
  97. org.springframework.orm.jpa
  98. org.springframework.orm.jpa.persistenceunit
  99. org.springframework.orm.jpa.support
  100. org.springframework.orm.jpa.vendor
  101. org.springframework.oxm.castor
  102. org.springframework.oxm.xmlbeans
  103. org.springframework.oxm.xstream
  104. org.springframework.remoting.caucho
  105. org.springframework.remoting.httpinvoker
  106. org.springframework.remoting.jaxws
  107. org.springframework.remoting.rmi
  108. org.springframework.remoting.support
  109. org.springframework.scheduling
  110. org.springframework.scheduling.annotation
  111. org.springframework.scheduling.commonj
  112. org.springframework.scheduling.concurrent
  113. org.springframework.scheduling.quartz
  114. org.springframework.scheduling.support
  115. org.springframework.scripting
  116. org.springframework.scripting.bsh
  117. org.springframework.scripting.groovy
  118. org.springframework.scripting.jruby
  119. org.springframework.scripting.support
  120. org.springframework.test
  121. org.springframework.test.annotation
  122. org.springframework.test.context
  123. org.springframework.test.context.junit4
  124. org.springframework.test.context.support
  125. org.springframework.test.context.testng
  126. org.springframework.test.context.transaction
  127. org.springframework.test.context.web
  128. org.springframework.test.jdbc
  129. org.springframework.test.web
  130. org.springframework.test.web.servlet.request
  131. org.springframework.test.web.servlet.result
  132. org.springframework.test.web.servlet.setup
  133. org.springframework.transaction
  134. org.springframework.transaction.annotation
  135. org.springframework.transaction.interceptor
  136. org.springframework.transaction.jta
  137. org.springframework.transaction.support
  138. org.springframework.ui
  139. org.springframework.ui.freemarker
  140. org.springframework.ui.velocity
  141. org.springframework.util
  142. org.springframework.util.comparator
  143. org.springframework.util.xml
  144. org.springframework.validation
  145. org.springframework.validation.beanvalidation
  146. org.springframework.web.bind
  147. org.springframework.web.bind.annotation
  148. org.springframework.web.bind.annotation.support
  149. org.springframework.web.client
  150. org.springframework.web.context
  151. org.springframework.web.context.request
  152. org.springframework.web.context.request.async
  153. org.springframework.web.context.support
  154. org.springframework.web.jsf
  155. org.springframework.web.method
  156. org.springframework.web.method.annotation
  157. org.springframework.web.method.support
  158. org.springframework.web.portlet
  159. org.springframework.web.portlet.handler
  160. org.springframework.web.portlet.mvc
  161. org.springframework.web.portlet.util
  162. org.springframework.web.servlet
  163. org.springframework.web.servlet.config.annotation
  164. org.springframework.web.servlet.i18n
  165. org.springframework.web.servlet.mvc
  166. org.springframework.web.servlet.mvc.annotation
  167. org.springframework.web.servlet.mvc.method.annotation
  168. org.springframework.web.servlet.mvc.multiaction
  169. org.springframework.web.servlet.mvc.support
  170. org.springframework.web.servlet.support
  171. org.springframework.web.servlet.tags
  172. org.springframework.web.servlet.tags.form
  173. org.springframework.web.servlet.view
  174. org.springframework.web.servlet.view.freemarker
  175. org.springframework.web.servlet.view.jasperreports
  176. org.springframework.web.servlet.view.json
  177. org.springframework.web.servlet.view.tiles2
  178. org.springframework.web.servlet.view.tiles3
  179. org.springframework.web.servlet.view.velocity
  180. org.springframework.web.servlet.view.xslt
  181. org.springframework.web.util

Groovy DSL bean definition support

Now in Spring 4 you can use the Groovy DSL bean configuration as an alternate to configure the bean definition.

Changes in the Spring Core

Following are the changes done in the Spring Core:

  1. Spring 4, @Description annotation has been added.
  2. The @Conditional is introduced in Spring 4 which can be used to filter the beans using some conditions.
  3. The @Ordered annotation introduced for ordering the autowired list and arrays.
  4. Support for custom annotations

Features of Spring Web module

Here are the features of Spring 4 Web modules:
1. The Servlet 3.0+ environment is need while testing the application. You should place servlet jar file in your test path while testing the application.
2. The @RestController annotation for defining the REST web services.
3. Timezone support for Spring MVC based application

Testing of application

Many new features are added to the Spring 4 framework for unit and integration testing of the applications. Which helps the developers to write better and bug free code.

原文地址: Features of Spring Framework 4: New features and enhancements in the Spring Framework 4

Spring 4.3.10 framework Spring Framework Reference Documentation

原创粉丝点击