Open In App

New Features of Spring MVC 6.0 and Thymeleaf 3.0

In this article, we will explore the latest features of Spring MVC 6.0 and Thymeleaf 3.0 and how they can be leveraged to develop enterprise applications.

Spring MVC is a fundamental and broader part of the Spring Framework. It is used to develop Java-based applications. Spring MVC uses a front controller pattern – all requests go through the DispatcherServlet which handles request routing. Annotations like @Controller, @RequestMapping are commonly used to build controller classes and map URLs to handler methods. Spring MVC makes it easy to build RESTful web services and integrate them with other Spring projects like Spring Security, Spring Data JPA, etc.



Thymeleaf 3.0 was a major release that brought many improvements and new capabilities. One of the biggest changes is support for HTML5 parsing, in the Previous versions of Thymeleaf parsed templates as XML, which could be limiting for HTML5 features like optional closing tags. Thymeleaf 3.0 fully supports HTML5 parsing out of the box.

Spring MVC 6.0 – New Features

For Example, here we have developed a Student Management System,

There are simple steps to interact with a simple web application built using Spring MVC:



Dependency:

<!-- https://mvnrepository.com/artifact/org.springframework/spring-webmvc -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>6.1.1</version>
</dependency>

Thymeleaf 3.0 Features

Required configuration for Thymeleaf

Dependency:

<!-- https://mvnrepository.com/artifact/org.thymeleaf/thymeleaf-spring5 -->
<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf-spring5</artifactId>
<version>3.1.2.RELEASE</version>
</dependency>

In Spring MVC, HTTP templates are reusable patterns for common HTTP requests like GET, POST, PUT, DELETE, etc. Some of the main HTTP request templates are:

Conclusion

In conclusion, Spring MVC 6.0 and Thymeleaf 3.0 have new features that enhance developers’ experience with more useful, minimalistic configurations and more functional approaches

Article Tags :