Spring Framework 5

Introduction to Java Spring Framework 5

Spring framework is one of the most popular Java frameworks which is used for developing diverse Java applications. It is designed to provide an infrastructure for easy development. It is also marketed as the “source of modern java.” Just like any other framework, it is also updated regularly to keep up with the changing development market.

The latest iteration right now is Spring 5. It is the Spring latest version. In this article, we will explore Spring 5 and provide a basic introduction related to it. This includes going through its major features one by one. This information on Spring Framework 5 will help you a lot if you’re preparing for Spring certification. So, let’s get ahead and learn about Spring Framework 5. 

Preparing for a Java interview? Go through these top 100 Java Interview Questions and get ready to ace the interview.

Introduction to Java Spring Framework 5

Spring is one of the top Java frameworks. Spring Framework 5 was first released in September 2017. The update came after a long time the version 4 was released way back in December 2013. 

Spring is versatile in its approach as it offers developers the ability to build applications using “plain old Java objects” which are also known as “POJOs”. So, how a developer can be benefited with Spring? For example, he can execute a Java method in a database without using transaction APIs but using local Java method as a message handler.

There are many possibilities in which Spring offers better control and is also configurable over vanilla Java. It brought a slew of new features and enhancement which we are going to discuss in the following sections.

Important Features of Spring Framework 5 

Spring Framework 5 has come up with some unique features along with compatibility and support. Let’s check out what are the Spring Framework 5 Features.

  • JDK Baseline Updates

Many baseline updates are pushed to Java Spring Framework 5, the spring latest version. These updates will ensure that Spring 5 works with the latest dependencies and technologies. The initial release saw the non-support for the Java 9 due to the late release date of Java 9. However, now it does support Java 9.

Spring 5 uses Java 8. It means that developers can take advantage of features such as lambda expressions. It also supports Java EE 7 and Java EE 8. As a developer, you can also use Bean Validation 2.0, Servlet 4.0, and JPA 2.2. The older versions are also supported. The Spring 5 update compasses other technologies’ growth as well and supports their latest version to ensure that new features can be used without much hassle.

  • Core Framework Revision

Spring 5 also saw new core framework updates. The latest updates are pushed so that the Java 8 features can be utilized without any issues. There are many new features, however, only a few of them are worth noticing. They are as follows.

– Method parameters in Spring 5 can be accessed, thanks to the Java 8 reflection enhancements efficiently.

– Core Spring interfaces now provide selective declarations.

– @NotNull and @Nullable are used to annotate nullable fields, arguments, and return values explicitly.

– NIO2 streams are used to do file operations instead of the regular FileInput/OutPut Stream. By doing so, performance is boosted for applications that utilize a lot of files.

– A new Commons Logging bridge, spring-jcl is used instead of the standard Commons Logging.

– Auto-detect is also turned on for JUL(java.util.logging), SLF4J, Log4j without the need for any extra bridges.

  • Reactive Programming

One of the biggest features that you will see in Spring framework 5 is the adoption of the new programming paradigm. It is based on reactive principles, and you can get a glimpse of what it has to offer in the reactive manifesto.

Spring 5 is also compatible with JDK 9 and Java 8 which made it a great pick for anyone who is looking to develop Java with the latest Java version. The game-changer here was reactive streams which made web development an exciting journey for developers. It is a language-neural attempt that will enable developers to define reactive APIs. To ensure that reactive streams can be used effectively, the Reactor is provided. It is a Reactive Streams Java implementation that offers its way to utilize the reactive features and core APIs.

With reactive programming as its theme, developers are excited as it will allow them to build next-level responsive and resilient services that would scale without any problem; thanks to the use of the new event-loop execution model.

The modules for the new Spring Web Reactive are available through the spring-web-reactive module. To know more, you can refer to a good Spring book and learn more about the Spring framework.

Also Read: Top 5 Java Frameworks

  • Functional Web Framework And Kotlin Support

Spring Framework 5 also brought support for functional programming. It does it by providing a Functional Web Framework. This way, developers can easily create endpoints using functional programming. The two main components that handle the framework include HandlerFunction and RouterFunction. Each of these two components has their own workload.

  • HandlerFunction: It handles all the incoming requests and then generates responses.
  • RouterFunction: It is used as an alternative to the @RequestMapping annotation which ensures that the incoming requests are sent to the handler functions.

Example of a RouterFunction

RouterFunction<String> route =


   request -> Response.ok().body(fromObject(“Hello World”)));

The functional programming can also be achieved with Kotlin language. It supports functional programming style and also supports the object-oriented paradigm. The Kotlin programming language runs on top of the JVM. Kotlin is extremely useful in enabling functional Spring programming which, in return, helps developers to develop functional web endpoints.


("/movie" and accept(TEXT_HTML)).nest {

GET("/", movieHandler::findAllView)

GET("/{card}", movieHandler::findOneView)


("/api/movie" and accept(APPLICATION_JSON)).nest {

GET("/", movieApiHandler::findAll)

GET("/{id}", movieApiHandler::findOne)



Example of how Kotlin code looks for Web functional API.

  • Core Container Updates

There are many core container updates to Spring 5.0. Let’s list them below to get a grasp of the changes.

  • Candidate component index is supported with the Spring Framework 5 instead of using the classpath scanning.
  • Loading component index is cheap. This means that the time to load the index will not increase with the increase in the number of classes used. However, the component scan will impact startup time significantly.
  • Developers can now read entities directly from the index rather than using the classpath scanning method. This will improve performance for projects that utilize less than 200 classes. However, using the method for the larger project means a significant impact.
  • Any current project can have its own META-INF/spring components file during the application building task.
  • Larger projects will start faster due to the above changes. However, it will not be instant, and developers still need to wait for 20-30 minutes before the project loads up.
  • Testing Improvements

Testing has also been improved in Spring 5.0. It includes the update to JUnit 5 Jupiter using JUnit 5. You can use it to write extensions and tests. It also comes with a test engine that offers Jupiter-based tests.

Parallel tests have also been supported. This means that you can run multiple tests using the Spring TestContext Framework. So, you might be thinking how the reactive programming model fits here? Don’t worry as spring-test now uses WebTestClient to support the Spring WebFlux.

The older JUnit 4 is also supported which means that it is not necessary to the use the latest JUnit release.

Dropped Features in Spring Framework 5 

The new Spring 5.0 introduced support for many frameworks and programming languages. But it also dropped support for many frameworks as well. They are the Protlet, XMLBeans, JDO, JasperReports, Guava, Velocity.

Support has also been dropped for many packages at an API level. Let’s list them below.

  • beans.factory.access
  • mock.staticmock
  • jdbc.support.nativejdbc
  • web.view.titles2M
  • Orm.hibernate3 and orm.hibernate4.

Also Read: Core Java Interview Questions

Final Words

This leads us to the end of our Java Spring Framework 5 introduction. We discussed the key features that Spring 5.0 has to offer. The Core Container updates ensure smooth development as it focuses on reducing the time to run a project. Other improvements include the addition of reactive programming paradigm and functional programming as well.

These features are bound to grow in the near future as we are going to see more macro and micro level updates to the Spring 5.0 Framework. If you are aspired to become a certified Java professional, join our Oracle Java certifications training and start your preparation.

However, Reactive programming will open new opportunities for developers as they can develop more scalable solutions. So, what do you think about Spring Framework 5? Are you going to use it in your projects? Comment below and let us know, we are listening!

About Aditi Malhotra

Aditi Malhotra is the Content Marketing Manager at Whizlabs. Having a Master in Journalism and Mass Communication, she helps businesses stop playing around with Content Marketing and start seeing tangible ROI. A writer by day and a reader by night, she is a fine blend of both reality and fantasy. Apart from her professional commitments, she is also endearing to publish a book authored by her very soon.

1 thought on “Introduction to Java Spring Framework 5”

  1. informative article about spring framework5..
    very effective technique…..
    i m very thankful for sharing this article……
    keep sharing…….

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top