In this Spring 5 Tutorial, learn new features and hello world example with Java annotation configuration.
1. What’s new in Spring 5?
Spring 5 is the first major release, almost four years after Spring Framework 4.0. During this time, most of the enhancements were done in Spring boot project. In Spring 5, these are some exciting features worth mention –
- Baseline upgrades – Spring 5 now supports minimum JDK 8 and Java EE 7. There are few more libraries for which minimum supported versions have been increased. For example – Servlet 3.1, JMS 2.0, JPA 2.1, JAX-RS 2.0, Bean Validation 1.1, Hibernate 5, Jackson 2.6, EhCache 2.10, JUnit 5 and Tiles 3.
Minimum supported version for servers have also gone up. For example – Tomcat 8.5, Jetty 9.4, WildFly 10 etc.
- JDK 9 runtime compatibility – Spring 5 supports Java 9, including Java modules.
- Usage of JDK 8 features – Spring 5 has baseline version 8, so it uses many new features of Java 8 and 9 as well. In fact, it has pretty extensive use of lambda functions.
- Reactive programming support – Spring Framework 5 embraces Reactive Streams (language-neutral attempt to define reactive APIs) and Reactor (java implementation of Reactive Streams provided by the Spring Pivotal team) for its own reactive use as well as in many of its core APIs.
- A functional web framework – Spring 5 also provides a functional web framework. It provides features to define endpoints using functional programming style.
- Kotlin support – Spring framework 5.0 has good support for Kotlin.
Read More: Spring 5 New Features
2. Spring 5 Examples
List of Spring 5 examples and tutorials.
2.1. Spring 5 Core
- Spring Bean Java Config Example
- Spring Bean XML Config Example
- Spring Bean Eager vs Lazy Initialization
- Spring bean scopes
2.2. Spring 5 WebMVC
- Spring @GetMapping and @PostMapping Example
- Spring DispatcherServlet Tutorial
- Spring 5 MVC + Hibernate 5 Example