In this article we are discussing about the new features of the Features of the Spring 4.1. There are many new exciting features added to the Spring 4.1 framework such as full support of Java 8 and improvements to the core container.
Features of the Spring Framework 4.1 - Java 8 Support, core container improvements, web improvements and many more
Spring framework 4.1 is the latest and most advanced after the Spring 4. Spring 4.1 is in RC1 phase and the GA version is expected in the August 2014. Here in this article we are discussing about the latest and new features of the Spring Framework 4.1.
The Spring Framework 4.1 is developed to fully support the features of the Java 8 and provide new API for creating the ever demanding enterprise applications. The minimum requirement to use the Spring 4.1 is the Java 6. It is advisable to start using the Spring 4.1 framework on the Java 8 as it is fully supporting the Java 8. You will be able to use the features of the Java 8 with Spring 4.1 framework.
Here are the Features of the Spring 4.1:
1. Deprecation removal
Many deprecated packages and methods are removed.
2. Auto-config for JMS
In the Spring 4.1 a new features of the auto-config for JMS has been introduced. Here are the new features introduced:
- The newly introduced JmsMessagingTemplate is similar to JmsTemplate, but it worked with the messaging abstraction and can be auto-configured. The auto-configuration works in the same as it was being done with the JmsTemplate.
- In Spring 4.1 a new feature introduced is the Annotated listener endpoints, which is used to define a new listener container through annotation.
3. Support for JCache
The major improvement is done in the Spring 4.1 and it is providing the improved support for the JCache (JSR-107) annotations through annotation. Now you can use the Spring 4.1 JCache feature to cache data in your application.
The following table describes the mapping between the Spring annotations and the JSR-107 counterpart:
Spring 4.1 | JSR-107 |
@Cacheable | @CacheResult |
@CachePut | @CachePut |
@CacheEvict | @CacheRemove |
@CacheEvict(allEntries=true) | @CacheRemoveAll |
You can use the annotation in your application to cache the data through Spring 4.1 JCache component.
Simple example of using the JCache is:
@CacheResult(cacheName = "students") public Book findStudents(String studentClass) {...}
CacheResolver introduction
The CacheResolver abstraction is created to to give the most flexible options for resolving the cache in the application.
4. Spring Expression Language (SpEL) compiler mode
The SpEL is used to for the selective compilation of the hotspot expressions into Java bytecode at runtime. The "spring.expression.compiler.mode" property can be used to configure it as "immediate" or "mixed" mode.
5. The Flexible resolution of static web resources
This functionality is packed into the org.springframework.web.servlet.resource package. It is used for the flexible resolution and transformation of static web resources in the web based applications.
6. Support for Groovy markup templates in the Web MVC application
A new template engine is added for providing the support for the Groovy markup templates in the Spring Web MVC applications. Now developers can use the Groovy markup templates in the Web applications.
7. There are many other improvements made to the Spring 4.1 framework
Here is the detail of the improvements and the refinements done in the Spring 4.1:
- Fully supporting the Java 8
- Java 8's Optional type can be used for the injection points and MVC handler method parameters
- The direct binding support for the nested fields
- Support for the auto-growing of the nested fields
- Declarative MVC resolution setup added to the the Spring 4.1
- WebSocket scope
- SockJS client support
- Exposing STOMP/WebSocket stats
- Declarative SQL scripts
Read more tutorials of the Spring 4.1 framework.
[ 0 ] Comments