New features of Spring5


   I have to feel that technology is growing by leaps and bounds, and there will never be a moment of rest. When you choose to engage in technology, you think that you must continue to learn and improve, otherwise you will fall behind. The Spring framework is very powerful and recognized by the industry. I'm still learning spring3.X or spring4.X outside, 5 has been launched, and I personally feel that these functions are not available at present, and it is estimated that it will take 3 years. Mark it first and see when it will be officially used..


Spring5 It is an important release, almost four years away from SpringFramework4. During this time, most enhancements were done in the SpringBoot project. In this article, we'll quickly learn about some of the exciting features in the Spring 5 release.

1. Baseline upgrade

To build and run Spring5 applications, you need at least J2EE7 and JDK8. Previous JDK and JavaEE versions are no longer supported. JavaEE7 includes:
Servlet 3.1
JMS 2.0
JPA 2.1
JAX-RS 2.0
Bean Validation 1.1
Similar to the Java benchmark, there are changes to the benchmarks for many other frameworks. For example:
Hibernate 5
Jackson 2.6
EhCache 2.10
JUnit 5
Tiles 3
Also, note the various server minimum supported versions.
Tomcat 8.5+
Jetty 9.4+
WildFly 10+
Netty 4.1+
Undertow 1.4+

2. Compatible with JDK9 runtime The

Spring 5 release is very close to the JDK9 release date. The goal is to get Spring Framework5 to work correctly after the GA of JDK9. The Spring 5 release candidate already supports Java 9 on the classpath and modulepath.
You can expect good JDK9 support in the GA release.

3. Use JDK8 features

Free Spring 5 new features video detailed explanation can be group: 554355695
Before Spring 4.3, the JDK baseline version is 6. So Spring4 must support Java6, 7 and 8. In order to maintain backward compatibility, Spring framework has not adapted to many new features brought by Java8, such as lambda expressions.
The base version of Spring 5 is 8, so it uses many new features of Java 8 and 9. For example:
Default methods in Spring interfaces Internal code improvements
based on Java8 reflection enhancements
Using functional programming in framework code - lambda expressions and streams 4.

Reactive programming support Reactive programming is one of the most important features of Spring Framework 5.0

. Reactive programming provides an alternative programming style that focuses on building applications that respond to events. Spring Framework 5 includes Reactive Streams (a language-neutral attempt to define reactive APIs) and Reactor (a Java implementation of Reactive Streams provided by the Spring Pivotal team) for its own purposes as well as many of its core APIs.
Spring Web Reactive is in the new spring-web-reactive module alongside the existing (and popular) Spring Web MVC in the spring-webmvc module. Note that in Spring5, traditional SpringMVC supports running on Servlet3.1, or a server that supports JavaEE7.

5. Functional web framework

In addition to reactive features, Spring 5 also provides a functional web framework. It provides features to define endpoints using a functional programming style. The framework introduces two basic components: HandlerFunction and RouterFunction.
HandlerFunction represents a function that handles a received request and generates a response. RouterFunction replaces the @RequestMapping annotation. It is used to route received requests to handler functions. For example:
RouterFunction<String> route =
route(GET("/hello-world"),
request -> Response.ok().body(fromObject("Hello World")));

6. Kotlin supports

Kotlin is a static Typed JVM language that makes code expressive, concise, and readable. Spring5.0 has good support for Kotlin.

7. Removed features

With the addition of Java, JavaEE, and some other framework baseline versions, SpringFramework5 dropped
support for several frameworks. Example:
Portlet
Velocity
JasperReports
XMLBeans
JDO
Guava

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326188218&siteId=291194637