Spring 5 Features and Enhancements
By Dhiraj Ray, 24 January,2017
As we all must be knowing the second milestone of Spring Framework 5.0 got released in September last year as a new functional web framework.It is completely based on Reactive Programming Model.Spring Framework 5.0 has many major enhancements and upgrades with Java 8 as a minimum requirement with a compatability with JDK 9.
Here is a brief note.
JDK 8 + 9 and Java EE 7 Baseline
- Java 8 as a minimum requirement as entire framework codebase is based on Java 8.
- Java EE 7 required to run Spring Framework 5.0 applications.Hence, requires Servlet 3.1, JMS 2.0, JPA 2.1
Removed Packages, Classes and Methods
- Package mock.static mock removed from spring-aspects module and hence no support for AnnotationDrivenStaticEntityMockingControl
- Packages such as web.view.tiles2 and orm.hibernate3/hibernate4 dropped.Hence Tiles 3 and Hibernate 5 be compulsarily used.
- Support for Portlet, Velocity, JasperReports, XMLBeans, JDO, Guava dropped.
- Most of the deprecated classes and methods removed.
Reactive Programming Model
As per wiki reactive programming is a programming paradigm oriented around data flows and the propagation of change. This means that it should be possible to express static or dynamic data flows with ease in the programming languages used, and that the underlying execution model will automatically propagate changes through the data flow.
In spring framework 5.0, following are the enhancements as a reactive programming model.
- spring-core, DataBuffer and Encoder/Decoder abstractions with non-blocking semantics.
- New WebClient with reactive support on the client side.
- Complete support for Junit 5 Jupiter and many enhancements in existing TestContext framework
- @ExtendWith - an implementation of multiple extension APIs from JUnit Jupiter.
- @SpringJUnitConfig - combines @ExtendWith from JUnit Jupiter with @ContextConfiguration from the Spring TestContext Framework.
- @SpringJUnitWebConfig - combines @ExtendWith from JUnit Jupiter with @ContextConfiguration and @WebAppConfiguration from the Spring TestContext Framework.
- @EnabledIf: signals that the annotated test class or test method is enabled if the supplied SpEL expression or property placeholder evaluates to true.
- @DisabledIf: signals that the annotated test class or test method is disabled if the supplied SpEL expression or property placeholder evaluates to true.
- Support for parallel test execution in the Spring TestContext Framework.
- MockHttpServletRequest now has getContentAsByteArray() and getContentAsString() methods for accessing the content (i.e., request body).
- The print() and log() methods in Spring MVC Test now print the request body if the character encoding has been set in the mock request.
I hope this article served you that you were looking for. If you have anything that you want to add or share then please share it below in the comment section.
Suggest more topics in suggestion section or write your own article and share with your colleagues.
Is this page helpful to you? Please give us your feedback below. We
would love to hear your thoughts on these articles, it will help us improve further our learning process.
Contact us: firstname.lastname@example.org