Spring Boot

This tutorial is about creating Lambda functions from Spring Cloud Functions. Spring Cloud Functions provide a way to implement the business logic via functions and decouple code development from the runtime target. Hence, the developer can focus solely on the implementation of logic. The developer need not worry about the target endpoint type, connectivity, integration,…

Read More Create AWS Lambda Functions from Spring Cloud Functions

This tutorial will demonstrate how to implement the One-to-Many Mapping in your Spring Boot application that uses Hibernate/Spring Data JPA. As a database, I will use a MySQL server. If you are learning about Hibernate, you might also be interested in the following tutorials: One-to-One Mapping Hibernate/JPA Using Spring Boot and MySQL Many-to-Many Relationship in…

Read More One to Many Mapping Hibernate/JPA Using Spring Boot and MySQL

This tutorial will demonstrate how One-to-One Mapping in Hibernate/Spring Boot Data JPA works. As a database, I will use a MySQL database server. We will create two JPA entities: the Book and the Story. The Book and the Story entities have one to one relationship, which means that the Book entity has a Story entity,…

Read More One to One Mapping Hibernate/JPA Using Spring Boot and MySQL

An important property of modern web apps is resilience. In simple terms, resilience refers to the ability of a system or feature to fail gracefully without impacting the entire system. In the context of web apps, we want to ensure that the entire system will not go down if a remote service, such as a…

Read More Enforcing Resilience in Spring Boot with Resilience4J

This tutorial is the fifth in a series on Reactive Programming in Java and Spring Framework. In this tutorial, we will develop a simple REST API using Spring Web flux. To completely understand this tutorial, it is better to read a previous tutorial first. It would also help to know how to develop a REST Controller using…

Read More Developing a REST API using Spring WebFlux

In this tutorial, you will learn how to create a custom password encoder in a Spring Boot application that uses Spring Security. Table of contents Create a Spring Boot project and add database connection properties, Add a User model, Create a User repository, Implement a custom PasswordEncoder, Create a service class that implements UserDetailService, Add…

Read More Custom Password Encoder in Spring Security

Multiple data source implementations are very crucial in instances where we want to secure the application from vulnerabilities such as a database failure. This will ensure that the application can still function even if part of the database went down. This tutorial will use student and course entities to demonstrate how multiple data sources can…

Read More Multiple Datasources in Spring Application

This article is the third of a series on Reactive Programming. If you have not read the previous article, I would strongly advise you to do so. In this article, we will discuss how Reactive Programming is made possible in Spring. Spring WebFlux Spring WebFlux is the Spring project that makes Reactive Programming possible in…

Read More Reactive Programming In Spring Framework

This tutorial demonstrates how to deploy a Spring Boot REST app to Tomcat 10. Apache states that the Jakarta EE platform represents the evolution of the Java EE platform. Tomcat 10 and later versions implement specifications that were developed as part of Jakarta EE. In contrast, Tomcat 9 and earlier versions implement specifications that were…

Read More Deploy a Spring Boot App as a WAR to Tomcat 10

This tutorial will teach you how to start your Spring Boot Web application on a different port number. Read the following tutorial to learn how to start your Spring Boot application on a random port number. By default, if no port number is configured, our Spring Boot Web application will start on port number 8080.…

Read More Start Spring Boot Application on a Different Port Number

This tutorial will teach you how to configure your Spring Boot application to log messages to a file. Specify File Path To make your application log messages to a file, you will need to configure a couple of new properties in the application.properties file. logging.file.path=/path/to/a/file logging.file.name=log.txt You might also need to enable a specific logging level…

Read More Log to File in Spring Boot

In this short tutorial, I am going to share with you how to switch your Spring Boot application, at runtime, to use a different logging level. Set Logging Level for a Package in Your App Suppose we have a Spring Boot Application with the following method in a Rest Controller class. @RestController @RequestMapping(“/users”) public class…

Read More Switch Logging Level in Spring Boot at Runtime

In this tutorial, you will learn how to use @AuthenticationPrincipal annotation to get the Jwt object containing the details of a provided in HTTP Request access token. When we send a request containing an access token in the Authorization header, behind the scenes,  Spring Framework will do a lot of work and if all is good,…

Read More @AuthenticationPrincipal – Getting the Jwt Claims

By default, Spring Boot RESTful web service endpoints consume and produce JSON representations. However, it’s possible to enable consuming XML and producing it for your REST API endpoints with minimal effort. This tutorial will guide you through the process of adding XML support to your Spring Boot application, allowing consuming XML and producing representations of…

Read More Consuming XML in Spring Boot REST

HATEOAS is a way to make your RESTful Web Service endpoint, automatically include links to other Resources of your API, in the response that it sends back to a calling client application.  The client application that consumes your web service endpoint, can then use those links, to consume other RESTful Resources that your Web Service…

Read More Add HATEOAS to Spring Boot RESTful Web Service