Injecting collection of objects in Spring

Spring boot can inject/autowire a collection of objects directly as dependencies to other beans and components. Let’s see how to make use of this feature with an example. We so far have seen the constructor dependency injection and setter dependency injection. In these posts, we only saw autowiring of single object parameters. But Spring framework…

Spring Boot Email using Thymeleaf with Example

Let us see how to send HTML emails using thymeleaf templates in a spring boot application. Things got easier with spring boot and thymeleaf template engine. As you know, Thymeleaf is used as a View in Spring MVC applications. However, do you know you can use the same template Engine for generating rich HTML emails?…

FreeMarker vs Groovy vs Mustache vs Thymeleaf

In this post, we will try to compare FreeMarker vs Groovy vs Mustache vs Thymeleaf with examples. Spring Boot supports FreeMarker, Groovy, Mustache and Thymeleaf. But, how do they compare with each other? Let’s find out which template engine is the best for different use-cases in spring boot. For this comparison, I have created four…

Spring Boot Custom Health Indicators

In this post, We will learn about writing Custom Health Check indicators for Spring Boot Applications. Spring Boot out-of-the-box health checks are good. But in the real world, it is often the case that one application relies on another application’s availability for performing operations. In this case, it would be helpful to add a health…

Spring Boot Health Endpoint

In this post, We will learn about Health check indicators of Spring Boot. Spring boot makes health checks easier for us by providing opinionated /actuator/health endpoint. Spring Boot Health actuator The HealthEndpoint of spring-boot-starter-actuator module collects Health information for any beans that are defined as HealthIndicator. For a simple web application, there are two HealthIndicator beans Auto-Configured by default. And they are for Ping health check and…

Spring Boot Structure and Convention

In this post, we will learn each part of Spring Boot project Structure and its conventions. Spring Boot is an opinionated view of how a Spring-based application should be implemented. Given that a lot of these opinions are on how Spring features should be used, Spring boot also emphasises the structure of the spring boot…

Install and Run Spring Boot Linux Service Guide

Let’s learn how to install a spring boot as a linux service. Requirements You will need, Basics of running a spring boot application Understanding linux services and file system. 15 minutes of your time. Make the jar an executable Spring boot applications can be started using the command java -jar hello-world.jar. We have seen this behaviour in the posts How…

Spring IOC Container

Traditionally, the flow of business logic depends on the statically defined objects and their dependents. This approach creates tightly coupled applications that are hard to extend or modify. But with IOC containers, the business logic depends on the object graph built by an IOC container. So what is an IOC Container? Inversion Of Control(IoC) is…

@SpringBootApplication annotation – How it works

Every spring boot application has the @SpringBootApplication annotation on its main class. On contrary to popular belief, it is not just there to inform that the application is a spring boot application. Let’s take a deep dive into what this annotation is and how it works with some examples. Introduction The @SpringBootApplication annotation is there…

JAR to WAR: Deploy Spring Boot on App Servers like Tomcat

In this post, We will learn about converting Spring Boot JAR to WAR file. We know that Spring Boot produces a fat JAR That helps You to start the app by running java -jar <your jar file>. We can deploy these JARs with ease. But in unavoidable situations, you may need a WAR file. Each application runs on a separate port….