Category: Spring Boot
-
Spring Boot password encryption for application properties file using Jasypt
1. Introduction In this tutorial, we’ll learn how to encrypt sensitive information in Spring Boot application configuration file (application.properties or application.yml), such as username and password of datasource using Jasypt library. When you create a Spring Boot application, you keep properties in configuration files (application.properties or application.yaml). You should not keep sensitive configuration values in…
-
Configure custom DataSource in Spring Boot
1. Introduction If spring-boot-starter-data-jpa dependency is used, Spring will try to configure the DataSource. You just have to provide the connection details in the property file to get started. However, if you have requirement to create your own DataSource, Spring allows you to do that. In this tutorial, we’ll discuss how to configure custom DataSource…
-
Documenting a Spring REST API Using OpenAPI 3.0
1. Introduction We need documentation to understand the code or a program. For example, documentation helps us understand what a method does and what it needs as arguments to perform the operation. Similarly, API documentation can also be generated which will be helpful to provide description, request and response format. Swagger is the most popular…
-
Spring Boot with Hibernate
In this tutorial, we’ll discuss how to integrate Spring Boot and Hibernate. In this tutorial, we’ll create a REST application and will integrate Hibernate. Step 1: Create a Spring Boot application with Hibernate dependencies In this tutorial we are using MySql as database. We’ll create a Spring Boot application with following dependencies: spring-boot-starter-data-jpa spring-boot-starter-web mysql-connector-java…
-
Spring Boot Actuator
1. Introduction We know that Spring Boot is an opinionated framework i.e. can be configured based on our definitions (‘starter’ dependencies we use). Spring Boot provides production ready features to monitor and manage your application by using Actuator module. In this tutorial, we’ll discuss Spring Boot Actuator. Spring Boot Actuator module allows you to manage…
-
Logging in Spring Boot
1. Introduction In this tutorial, we’ll discuss logging in Spring Boot. Spring Boot makes it very easy to implement logging in application. You can use all popular logging frameworks like Commons Logging, Log4J, or SLF4J with Spring Boot. Spring Boot makes it very easy to use logging frameworks and comes with default configurations. Generally, you’ll…
-
Disable banner in Spring boot
1. Introduction When Spring Boot application is started, a banner is printed. The banner looks like the following: Sometimes you may want to customize this banner. For example, if you want to show the name of your application or product at application startup, you can choose to customize the banner. You can also choose not…
-
Custom banner in Spring Boot
1. Introduction Whenever Spring Boot application is started, a banner is printed. The banner looks like the following: This startup banner can be customized. We can use custom text as well as image. 2. How to customize banner in Spring Boot? There are two ways to change the banner: Adding banner.txt file in classpath. In…
-
Lazy Initialization in Spring Boot
1. Introduction In this tutorial, we’ll discuss lazy initialization in Spring Boot application. By default in Spring, beans are created at application startup. However, we can override this default behavior. There may be a requirement to not create a bean at application startup. The reason could be many. If the creation of bean is too…
-
Spring Boot DevTools
1. Introduction to DevTools Spring Boot became popular as it made easier to create production grade application and run. Spring Boot provides additional set of tools which help in development. These tools are provided in spring-boot-devtools module. When included in the project, it provides extra features to the developers. Following are the Maven and Gradle…