Shell Scripts to start and Stop Spring Boot Applications.

In this post, We will learn about start and stop shell scripts to run Spring Boot applications. Spring boot applications are easier to build and run. However, there is one small problem. Most of the developers still struggle when it comes to running, stopping, and starting the application in production servers. The traditional applications were deployed…

Spring Boot Starters

Spring Boot Starters add or change the behavior of an application. Starters do this through opinionated defaults and auto-configurations. Background In a traditional web application, The developers will have to do the following stuff. Write a spring-context.xml to define the beans required. Write definitions for your database configuration. Define MVC configuration and their mappings/filters/etc. Create a web.xml to…

Spring Boot Hello World Tutorial

Let’s build a Hello World web application using Spring Boot. We will go through step by step to learn how to do this. Generate A Spring Boot Project There are multiple ways to set up a Spring Boot application. However, the easiest way to do it is via Spring Initializer. Open the Spring Initializer page…

N+1 Selects problem in Hibernate and How to Avoid it

Let us talk about the infamous N+1 selects problem in hibernate entities and how to solve it with some examples. You may have also heard it as an N+1 queries problem in some places. What is the N+1 selects problem? The N+1 selects problem is a performance anti-pattern where an application makes N+1 small queries to the…

Accessing Command-line Arguments in Spring Boot

Let’s learn how to read command-line arguments of a Spring Boot Application. Like any other java program, Spring Boot can take program parameters of application parameters on startup. But spring boot goes extra-mile to argument parsing. Lets get into the details. CommandLineRunner and ApplicationRunner These two interfaces are similar in nature and help you access…

Paginating RESTful API responses in Spring MVC

Pagination lets you split large RESTful API responses from Spring MVC into smaller chunks called pages. In this post, let us see how to use Spring MVC and Spring JPA to paginate a JSON response from a spring boot application. Pagination and Sorting in Spring MVC As we have seen earlier, we can implement pagination…

Pagination and Sorting in Spring JPA

Let’s learn how to use Process a large number of records effectively using Pagination and Sorting in Spring Data JPA. What is Pagination and Sorting? Most often, the result set from a database can be overwhelming. It can be overwhelming to a point where systems crash because they can’t handle that much data on a…

Spring Data JPA: @OneToMany Annotation

In this post, We will take a look at one to many mapping with spring data jpa. With a simple spring boot application, we will walkthrough through how to implement @OneToMany annotation the right way. One To Many Relationship mapping In the object-relational model, the One-To-Many relationship refers to One parent entity that has a…

Spring Data JPA @ManyToOne Annotation

Let us learn how to use @ManyToOne annotation in Spring Data JPA with a spring boot application as an example. What is Many To One Relationship? The many-to-one mapping or association means that one parent record can have multiple child records. In other words, multiple records of a table can associate themselves with a common…

Introduction to Spring Data JPA

The Spring JPA ( also known as spring Data JPA) is one of the spring modules that deal with storing, retrieving, and searching entity objects. In this post, we will take a look at spring JPA in detail using the spring boot application. Introduction Spring Data JPA revolves around the org.springframework.data.repository.Repository interface. This interface acts…