Spring 5 Features and Enhancements

Spring 5 Features and Enhancements thumbnail
15K
By Dhiraj 24 January, 2017
spring-logo

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
 Other Interesting Posts
Password Encoding using Bcrypt Encoder
Spring Boot Security Redirect after Login with complete JavaConfig
Spring Security Hibernate Example with complete JavaConfig
Securing REST API with Spring Security Basic Authentication
Spring Boot Security Custom Form Login Example
Spring JMS Activemq Integration with Spring Boot
Websocket spring Boot Integration without STOMP with complete JavaConfig
Spring MVC Angularjs Integration with complete JavaConfig
Spring Hibernate Integration with complete JavaConfig
Spring Junit Integration with complete JavaConfig
Spring Ehcache Cacheable Example with complete javaConfig
Spring Boot Spring MVC Example
Spring Boot Thymeleaf Example
Maintaining Spring Session during Websocket Connection

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.

Testing Improvements

  • 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.

Conclusion

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.

Share

If You Appreciate This, You Can Consider:

We are thankful for your never ending support.

About The Author

author-image
A technology savvy professional with an exceptional capacity to analyze, solve problems and multi-task. Technical expertise in highly scalable distributed systems, self-healing systems, and service-oriented architecture. Technical Skills: Java/J2EE, Spring, Hibernate, Reactive Programming, Microservices, Hystrix, Rest APIs, Java 8, Kafka, Kibana, Elasticsearch, etc.

Further Reading on Spring MVC