Features of Spring 4

Spring Framework 4 is released with many new features and improvements. In this article we are discussing about the new features of Spring Framework 4.

Features of Spring 4

Features of Spring Framework 4: New features and enhancements in the Spring Framework 4

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 4 Framework features

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.

Here are the new Features of Spring 4

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.

Advertisement

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:

  • Support for real-time full dupled communications over TCP
  • Web application can use the ports 80 and 443 using the URL Schemes ws:// and wss:// respectively
  • There will be small overhead for text messages making it more interactive for users
  • 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:

  • JMS 2.0
  •  JTA 1.2
  • JPA 2.1
  •  Bean Validation 1.1
  • JSR-236 Concurrency Utilities and many other features of JEE 7

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:

  • org.springframework.core.enums
  • org.springframework.ejb.support
  • org.springframework.instrument.classloading.oc4j
  • org.springframework.orm.ibatis
  • org.springframework.orm.ibatis.support
  • org.springframework.remoting.jaxrpc
  • org.springframework.scheduling.backportconcurrent
  • org.springframework.scheduling.timer
  • org.springframework.test.context.junit38
  • org.springframework.test.jpa
  • org.springframework.web.servlet.view.tiles
  • org.springframework.web.struts

Here is the list of added package in Spring 4:

  • org.springframework.beans.factory.groovy
  • org.springframework.cache.guava
  • org.springframework.format.datetime.standard
  • org.springframework.messaging
  • org.springframework.messaging.converter
  • org.springframework.messaging.core
  • org.springframework.messaging.handler
  • org.springframework.messaging.handler.annotation
  • org.springframework.messaging.handler.annotation.support
  • org.springframework.messaging.handler.invocation
  • org.springframework.messaging.simp
  • org.springframework.messaging.simp.annotation
  • org.springframework.messaging.simp.annotation.support
  • org.springframework.messaging.simp.broker
  • org.springframework.messaging.simp.config
  • org.springframework.messaging.simp.stomp
  • org.springframework.messaging.simp.user
  • org.springframework.messaging.support
  • org.springframework.messaging.tcp
  • org.springframework.messaging.tcp.reactor
  • org.springframework.util.concurrent
  • org.springframework.web.socket
  • org.springframework.web.socket.adapter
  • org.springframework.web.socket.adapter.jetty
  • org.springframework.web.socket.adapter.standard
  • org.springframework.web.socket.client
  • org.springframework.web.socket.client.jetty
  • org.springframework.web.socket.client.standard
  • org.springframework.web.socket.config
  • org.springframework.web.socket.config.annotation
  • org.springframework.web.socket.handler
  • org.springframework.web.socket.messaging
  • org.springframework.web.socket.server
  • org.springframework.web.socket.server.jetty
  • org.springframework.web.socket.server.standard
  • org.springframework.web.socket.server.support
  • org.springframework.web.socket.sockjs
  • org.springframework.web.socket.sockjs.frame
  • org.springframework.web.socket.sockjs.support
  • org.springframework.web.socket.sockjs.transport
  • org.springframework.web.socket.sockjs.transport.handler
  • org.springframework.web.socket.sockjs.transport.session

Here is the list of changed packages in Spring 4:

  • org.springframework.aop
  • org.springframework.aop.aspectj
  • org.springframework.aop.aspectj.annotation
  • org.springframework.aop.aspectj.autoproxy
  • org.springframework.aop.config
  • org.springframework.aop.framework
  • org.springframework.aop.framework.autoproxy
  • org.springframework.aop.framework.autoproxy.target
  • org.springframework.aop.interceptor
  • org.springframework.aop.support
  • org.springframework.aop.support.annotation
  • org.springframework.aop.target
  • org.springframework.asm
  • org.springframework.asm.util
  • org.springframework.beans
  • org.springframework.beans.factory
  • org.springframework.beans.factory.annotation
  • org.springframework.beans.factory.config
  • org.springframework.beans.factory.serviceloader
  • org.springframework.beans.factory.support
  • org.springframework.beans.factory.xml
  • org.springframework.beans.propertyeditors
  • org.springframework.beans.support
  • org.springframework.cache
  • org.springframework.cache.concurrent
  • org.springframework.cache.ehcache
  • org.springframework.cache.interceptor
  • org.springframework.cache.jcache
  • org.springframework.cache.transaction
  • org.springframework.cglib.transform.impl
  • org.springframework.context.annotation
  • org.springframework.context.event
  • org.springframework.context.i18n
  • org.springframework.context.support
  • org.springframework.core
  • org.springframework.core.annotation
  • org.springframework.core.convert
  • org.springframework.core.env
  • org.springframework.core.io
  • org.springframework.core.io.support
  • org.springframework.core.task
  • org.springframework.core.type
  • org.springframework.core.type.classreading
  • org.springframework.core.type.filter
  • org.springframework.dao.support
  • org.springframework.ejb.access
  • org.springframework.expression
  • org.springframework.expression.common
  • org.springframework.expression.spel.ast
  • org.springframework.expression.spel.support
  • org.springframework.format.datetime.joda
  • org.springframework.http
  • org.springframework.http.client
  • org.springframework.http.client.support
  • org.springframework.http.converter
  • org.springframework.http.converter.json
  • org.springframework.http.converter.xml
  • org.springframework.http.server
  • org.springframework.instrument
  • org.springframework.instrument.classloading.tomcat
  • org.springframework.jca.cci.object
  • org.springframework.jca.endpoint
  • org.springframework.jca.support
  • org.springframework.jca.work.jboss
  • org.springframework.jdbc
  • org.springframework.jdbc.core
  • org.springframework.jdbc.core.metadata
  • org.springframework.jdbc.core.namedparam
  • org.springframework.jdbc.core.simple
  • org.springframework.jdbc.core.support
  • org.springframework.jdbc.datasource
  • org.springframework.jdbc.object
  • org.springframework.jdbc.support
  • org.springframework.jdbc.support.lob
  • org.springframework.jdbc.support.xml
  • org.springframework.jms.connection
  • org.springframework.jms.core
  • org.springframework.jms.listener
  • org.springframework.jms.listener.adapter
  • org.springframework.jms.listener.endpoint
  • org.springframework.jms.remoting
  • org.springframework.jms.support.converter
  • org.springframework.jmx.access
  • org.springframework.jmx.export
  • org.springframework.jmx.export.assembler
  • org.springframework.jndi
  • org.springframework.jndi.support
  • org.springframework.mock.web
  • org.springframework.orm
  • org.springframework.orm.hibernate3
  • org.springframework.orm.hibernate3.annotation
  • org.springframework.orm.hibernate3.support
  • org.springframework.orm.hibernate4
  • org.springframework.orm.hibernate4.support
  • org.springframework.orm.jdo
  • org.springframework.orm.jdo.support
  • org.springframework.orm.jpa
  • org.springframework.orm.jpa.persistenceunit
  • org.springframework.orm.jpa.support
  • org.springframework.orm.jpa.vendor
  • org.springframework.oxm.castor
  • org.springframework.oxm.xmlbeans
  • org.springframework.oxm.xstream
  • org.springframework.remoting.caucho
  • org.springframework.remoting.httpinvoker
  • org.springframework.remoting.jaxws
  • org.springframework.remoting.rmi
  • org.springframework.remoting.support
  • org.springframework.scheduling
  • org.springframework.scheduling.annotation
  • org.springframework.scheduling.commonj
  • org.springframework.scheduling.concurrent
  • org.springframework.scheduling.quartz
  • org.springframework.scheduling.support
  • org.springframework.scripting
  • org.springframework.scripting.bsh
  • org.springframework.scripting.groovy
  • org.springframework.scripting.jruby
  • org.springframework.scripting.support
  • org.springframework.test
  • org.springframework.test.annotation
  • org.springframework.test.context
  • org.springframework.test.context.junit4
  • org.springframework.test.context.support
  • org.springframework.test.context.testng
  • org.springframework.test.context.transaction
  • org.springframework.test.context.web
  • org.springframework.test.jdbc
  • org.springframework.test.web
  • org.springframework.test.web.servlet.request
  • org.springframework.test.web.servlet.result
  • org.springframework.test.web.servlet.setup
  • org.springframework.transaction
  • org.springframework.transaction.annotation
  • org.springframework.transaction.interceptor
  • org.springframework.transaction.jta
  • org.springframework.transaction.support
  • org.springframework.ui
  • org.springframework.ui.freemarker
  • org.springframework.ui.velocity
  • org.springframework.util
  • org.springframework.util.comparator
  • org.springframework.util.xml
  • org.springframework.validation
  • org.springframework.validation.beanvalidation
  • org.springframework.web.bind
  • org.springframework.web.bind.annotation
  • org.springframework.web.bind.annotation.support
  • org.springframework.web.client
  • org.springframework.web.context
  • org.springframework.web.context.request
  • org.springframework.web.context.request.async
  • org.springframework.web.context.support
  • org.springframework.web.jsf
  • org.springframework.web.method
  • org.springframework.web.method.annotation
  • org.springframework.web.method.support
  • org.springframework.web.portlet
  • org.springframework.web.portlet.handler
  • org.springframework.web.portlet.mvc
  • org.springframework.web.portlet.util
  • org.springframework.web.servlet
  • org.springframework.web.servlet.config.annotation
  • org.springframework.web.servlet.i18n
  • org.springframework.web.servlet.mvc
  • org.springframework.web.servlet.mvc.annotation
  • org.springframework.web.servlet.mvc.method.annotation
  • org.springframework.web.servlet.mvc.multiaction
  • org.springframework.web.servlet.mvc.support
  • org.springframework.web.servlet.support
  • org.springframework.web.servlet.tags
  • org.springframework.web.servlet.tags.form
  • org.springframework.web.servlet.view
  • org.springframework.web.servlet.view.freemarker
  • org.springframework.web.servlet.view.jasperreports
  • org.springframework.web.servlet.view.json
  • org.springframework.web.servlet.view.tiles2
  • org.springframework.web.servlet.view.tiles3
  • org.springframework.web.servlet.view.velocity
  • org.springframework.web.servlet.view.xslt
  • 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:

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

Features of Spring Web module

Here are the features of Spring 4 Web modules:

  • 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.
  • The @RestController annotation for defining the REST web services.
  • 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.

Check Spring Framework 4.0 latest tutorials.