In this series of Spring 4 tutorial we will learn spring 4 framework with examples. Actually Spring 4 is like a new spring era for IT Industry from Spring community.
The Spring Framework was first released in 2004; since then there have been significant major revisions: Spring 2.0 provided XML namespaces and AspectJ support; Spring 2.5 embraced annotation-driven configuration; Spring 3.0 introduced a strong Java 5+ foundation across the framework codebase, and features such as the Java-based @Configuration model.
Version 4.0 is the latest major release of the Spring Framework and the first to fully support Java 8 features. You can still use Spring with older versions of Java, however, the minimum requirement has now been raised to Java SE 6. We have also taken the opportunity of a major release to remove many deprecated classes and methods.
On Dec 2009 – Spring 3.0 released. In this time, there is lot of changes in the spring community. Spring is not just seen as the framework, it is moving beyond that level and seen as a enterprise solution provider. Spring is largest Java community in the world. After the acquisition by VMWare, Vmware and EMC has joined and started a initiative called Pivotal. Spring is integrated with the Pivotal team and providing all the Java solutions needed for the Pivotal customers. By looking at the new projects and road map of Spring, it is exciting to see them in the future.
Spring framework consists of more than 20 modules grouped together. These are largely categorized as Core Container, Data Access/Integration, Web, AOP (Aspect Oriented Programming), Instrumentation, and Test. These are very well depicted in the below diagram.
Spring Framework 4.0 Announced-
After nearly four years the popular Spring Framework is getting an upgrade from version 3 to version 4. Spring Framework co-founder and project lead Juergen Hoeller announced on his blog that the first milestone has been cut, although no early-access download link was provided.
The theme of version 4.0 seems to be Java SE 8 (based on OpenJDK 8 build 88+) and Java EE 7 support, plus some new usability features.
Spring Framework 4.0, a brand new major version of Spring that keeps Spring at the cutting edge of modern Java development. Together with the rest of the upcoming Spring IO Platform, Spring Framework 4.0 is positioned to empower the next decade of JVM based innovation, responding to, and setting trends in Developer Productivity, Big Data, Cloud, REST, and Micro Service Architecture.
Spring Framework 4.0 works beautifully with Java 8 and also allows applications to be written partially or entirely in Groovy, a concise dynamic language on the JVM. Spring Framework 4.0 also provides the foundation for new advances in the Spring IO platform such as Spring Boot. Spring Boot nearly eliminates initial configuration work altogether. Developer productivity options like these are typically associated with single-purpose frameworks that are limited in scope and simply do not offer the breadth, depth, and years of battle-tested production usage that Spring offers.
Spring 4 Features-
1. Spring Framework 4.0:
It provides support for several Java 8 features. You can make use of lambda expressions and method references with Spring’s callback interfaces.
2. Conditional Annotation in Spring 4 :
Conditional Annotation Indicates that a component is only eligible for registration when all specified conditions match. The primary objective is to create the bean only after the set of conditions are met.
3. RestController in Spring 4 :
One of the API improvements is new @RestController annotation which is inherited from the @Controller annotation. Prior to the version 4.0, all the Spring MVC components has to use the common @Controller annotation to mark that as the controller servlet.
4. General Web Improvements:
Deployment to Servlet 2.5 servers remains an option, but Spring Framework 4.0 is now focused primarily on Servlet 3.0+ environments. If you are using the Spring MVC Test Framework you will need to ensure that a Servlet 3.0 compatible JAR is in your test classpath.
Contents for Spring 4.0 Framework–
- New Features and Enhancements in Spring Framework 4.0
- Environment Setup for Spring Framework 4.0
- Hello World Example using Spring Framework 4.0 API
- RestController in Spring Framework 4.0
- Conditional Annotation in Spring 4.0
- @ControllerAdvice improvements in Spring 4