An overview of the new features of spring 4

Spring 4.1 has released RC1 version, while GA version is expected to be released in mid September 2014; Some of the contents are directly borrowed from spring boot, which is already the top project of spring from the current trend; In addition, the page automation test framework spring MVC test htmlunit is also provided. Like spring MVC test, it is an independent project first. If the development trend is good, it will eventually be incorporated into the spring framework.

At present, spring 4.1 is not particularly eye-catching. It is mainly enhanced and some dependent version upgrades. The main improvements are as follows:

1. The core part is basically unchanged. Directfieldaccessor is provided for direct field access, yaml configuration, byte code compilation of spiel, basic implementation of backoff backoff algorithm, base64utils, smartinitializingsingsingleton, etc;

2. The exception handling part is added to the task scheduling and event mechanism;

3. The cache part includes jcache integration, class level @ cacheconfig support and cacheresolver;

4. The MVC part provides MVC tags of some view parsers to simplify configuration, groovywebapplicationcontext for groovy Web integration, httpmessageconverter of gson and protobuf, resolver and transformer added in static resource processing, groovy templates template support, jsonp support, Jackson's @ jsonview support, etc;

5. It provides a page automation test framework spring MVC test htmlunit;

6. The test part provides a more convenient @ SQL tag to initialize the test script, the support of mockrestserviceserver for ayncresttemplate, and the mockmvcconfigurer to globally configure mockmvc;

7、 It provides support for Java 8 optional (objecttooptionalconverter implementation; binding of annotations such as @ requestparam in MVC). From spring 4.1, ehcache support requires ehcache 2.5 or higher, is compatible with quartz 2.1.4, and supports javax.annotation.priority (equivalent to @ order), JMS API enhancements, and spring JUnit 4classrunner require JUnit 4.9 or later support.

From the current development, spring focuses on spring boot. On the other hand, the spring system is too large. It is very troublesome to find and add dependencies and select versions, and it is easy to produce version conflicts. Therefore, spring IO platform is born. If Maven is used, it is equivalent to giving you many default dependencies, and then add them directly when necessary, You do not need to specify a version.

As can be seen from the above, there are few attractive new features. In addition, it is still unstable at present. The API changes and the functions have bugs. If there is no control ability, it is not recommended to use the new features for new projects. I will explain spring 4 in the following parts 1 new features:

Spring core and others

Spring caching framework enhancements

Exception handling of asynchronous call and event mechanism

Database integration test script initialization

Spring MVC enhancements

Introduction to page automation test framework spring MVC test htmlunit

Static resource processing enhancements

At present, I have the impression that the spring framework is already very large, and its basic use is still relatively simple. If we go deeper, basically all the functions we need can be extended, which is what I admire most. At present, the worst thing for me is that both Java config and XML config support, which will give people a sense of confusion; In fact, it is best to extract this configuration into a project separately. Because when I tested spring 4.1, I encountered an implementation error under Java config and XML config. From the current development trend,

1. Promote their groovy;

2. Microservices;

3. Various ecological integration around;

4. At present, what needs to be solved most is to simplify the use; Too many functions result in high learning costs, which will scare away some people. It's really handy to work with the spring ecosystem.

Dependency:

Use 4.1 0. Build-snapshot, please use spring's official Maven warehouse to download dependencies.

Java code

summary

The above is an overview of the new features of spring 4 introduced by Xiaobian. I hope it will be helpful to you. If you have any questions, please leave me a message and Xiaobian will reply to you in time. Thank you very much for your support for the programming tips website!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>