Spring Boot Flyway Database Migration Tutorial

Spring Boot Flyway Database Migration Tutorial

In the previous Spring Boot JdbcTemplate Tutorial we have seen how to initialize database using schema.sql and data.sql scripts. This may be useful for demos and quick prototypes, but for real world applications we should use a database migration tool. Flyway is one of the most popular Java-based database migration libraries. Database migrations can be performed using Flyway as a standalone library, using flyway-maven-plugin or using Flyway Gradle plugin. Spring Boot provides out-of-the-box support for Flyway database migrations.

Continue reading »
Spring Boot Database Transaction Management Tutorial

Spring Boot Database Transaction Management Tutorial

Spring provides a high-level abstraction on top of JDBC with JdbcTemplate to make it easier to perform database operations. Spring also provides a high-level abstraction on top of JPA with Spring Data JPA to make it easy to implement CRUD operations, sorting, pagination, etc. Whether you use JdbcTemplate or JPA/Hibernate or Spring Data JPA, you need to take care of handling database transactions. A database transaction is a single unit of work, which either completes fully or does not complete at all, and leaves the database in a consistent state.

Continue reading »
Spring Boot JdbcTemplate Tutorial

Spring Boot JdbcTemplate Tutorial

Introducing Spring Boot JDBC Support Spring’s JdbcTemplate provides high-level abstraction on top of DataSource to perform database operations. In addition to that Spring’s declarative Transaction Management capabilities helps to manage database transactions in a simplified way without having to write boilerplate code. Spring Boot simplifies the configuration of DataSource, TransactionManager, etc. by using it’s AutoConfiguration mechanism. How SpringBoot AutoConfiguration magic works? If you want to learn more about Spring Boot AutoConfiguration, see How SpringBoot AutoConfiguration magic works?

Continue reading »
Spring Boot Profiles Tutorial

Spring Boot Profiles Tutorial

Introducing Spring Profiles Typically, software applications run in different environments. During development, it will be local, and then we may deploy it on QA, Staging, Performance and finally in Production environments. You may have to configure your application with different configuration properties while running the application in different environments. For example, if you are using a database then you may configure the database connection properties to a locally running database during development.

Continue reading »
Spring Boot Logging Tutorial

Spring Boot Logging Tutorial

Logging is a common and important requirement for running applications in production. Spring Boot provides great support for application logging out of the box and offers various customization options. In this tutorial, you will learn how to implement logging in your Spring Boot application using Logback and Log4j2. Getting Started with Spring Boot If you are new to Spring Boot, refer Getting Started with Spring Boot tutorial to learn how to create a Spring Boot project.

Continue reading »
Spring Boot Application Configuration Tutorial

Spring Boot Application Configuration Tutorial

In the previous Spring Boot Testing Tutorial, we have learned how to write unit, slice and integration tests for a Spring Boot application. In this tutorial, you will learn how to configure your Spring Boot application using properties and YAML files for running the application in different environments. Externalizing Spring Boot Application Configuration Any non-trivial application will have some configuration that you would like to make it configurable instead of hard-coding those values in the application code.

Continue reading »
Spring Boot Testing Tutorial

Spring Boot Testing Tutorial

In the previous Getting Started with Spring Boot tutorial, we have learned how to create a Spring Boot application and built a simple REST API. In this tutorial, you will learn how to write unit, slice and integration tests for your Spring Boot application. Testing Spring Boot applications We should write Unit Tests to verify the business logic of a particular unit(a class, a method, or a set of classes), and they shouldn’t be talking to any external services like database, queues or other webservices etc.

Continue reading »
Getting Started with Spring Boot

Getting Started with Spring Boot

Introducing Spring Boot Spring Boot is the most popular framework for building applications in the Java world. Spring Boot is an Opinionated and Convention Over Configuration based approach to building Spring framework based applications. Using Spring Boot, you can build different kinds of applications such as monolithic applications, microservices, serverless applications, Batch applications, etc. Let us take a quick look at what are the key features of Spring Boot that make it so popular.

Continue reading »
Announcing My "SpringBoot - The Missing Guide" Video Series on YouTube

Announcing My "SpringBoot - The Missing Guide" Video Series on YouTube

TLDR; I am happy to announce that I am starting the SpringBoot - The Missing Guide video series on my SivaLabs YouTube Channel. This SpringBoot - The Missing Guide video series is for those who need help understanding SpringBoot’s magic. In this series, I will explain the core concepts used in Spring and SpringBoot with practical examples. Also, I will give a deep-dive explanation of SpringBoot’s AutoConfiguration and how to customize the default configuration.

Continue reading »
My Plans for 2023

My Plans for 2023

First of all, Wish you a very happy new year and I hope this year will bring more joy and happiness into your lives. I would like to share how was 2022 for me and what my plans are for 2023. Highlights of 2022 The year 2022 is very eventful for me and lots of interesting things happened. 1. “How to Become a Software Architect” series with in28minutes and JavaBrains I collaborated with in28minutes Ranga and JavaBrains Koushik and did a “How to Become a Software Architect” series

Continue reading »