Spring @Async to increase performance in 3 steps

Lets learn about Spring Boot @Async annotation and use it to achieve Async (asynchronous) method execution in Spring Boot. Introduction to @Async annotation Normally, A program would run from top to bottom. But sometimes, one operation or method may take time and it would cause other methods to wait. In these cases, it makes sense…

Comparators and equality in Thymeleaf

Even though we do not pay attention to these operations much, Comparators and equality operators are the key aspects in thymeleaf expressions. In this post, we will see how these operators can be used. Comparison Operators (Comparators) You can compare values and expressions using the >, <, >= and <= Comparators. These operators behave the same way as they would behave in most…

Handling Enums in Thymeleaf templates

Select tag in HTML is usually a form input with a set of pre-defined options. Even though it is common to hard code these values, thymeleaf can offer you much more leverage with Enum support. Let’s see how we can do that. Enum Setup An Enum in java is a data type that allows us to define a set of…

Handling Lists in Thymeleaf view

In this article, We will see how to handle Lists in thymeleaf templates with an example using th:each attribute. Loop through a Lists Let’s create a list of Objects first and then supply it to the Model and View. For this reason, We created a UserInfo object. The list we are going to use in our thymeleaf model is…

Boolean in Thymeleaf for Conditional Evaluation

Thymeleaf relies a lot on boolean conditionals to render the HTML views. In this post, we will see how thymeleaf handles boolean values. Boolean expressions in Thymeleaf Everything can be evaluated into boolean in thymeleaf. To categorize, The following values are considered false. An expression or a literal that is false. A String literal that equals…

Thymeleaf Literals and Constants in Spring Boot

In this post, We will see how to use String literals,numeric and boolean constants in thymeleaf templates with an example in a spring boot application. Spring Boot can support any primitive data type to be a literal in an expression. To clarify, all number types, Char types, boolean type and ofcourse strings. Text literals in…

Thymeleaf Expressions in Spring Boot

Thymeleaf let us create dynamic views via extensive use of expressions in the template files. The simple form of expressions fall into four main categories. Variable expressions Variable expressions are the most commonly used ones in thymeleaf templates. These expressions help bind the data from the template context(model) into the resulting html(view). For example, The…

Thymeleaf Fragments in Spring Boot Application

Thymeleaf fragments let you break down your templates into reusable layout elements. For example, Several pages may have different content but still have the same header and footer. In these cases, Writing these into a separate template file and reusing it is not a bad idea. Fragments in Action Let’s take this snippet from a…

Thymeleaf CRUD web Application with Example

In this post, We will try to create a Simple Thymeleaf CRUD web application using Spring Boot. A CRUD application lets you Create, Read, Update and Delete things like files, database entries etc. With the help of JPA repositories and their built-in methods, it’s easy implement this. In this guide, we’ll learn how to build a CRUD web application with…

Thymeleaf Form Handling in Spring Boot

In this post, we will take a look how to handle form submission in spring boot and how to bind form elements to a Model object. Typical Form handling For applications that use Thymeleaf views, AJAX may be overkill. But form handling is not simple. At least in the context of Spring MVC. One way…