Spring Framework

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

In this tutorial, I’ll guide you on how to use the new OAuth2 Authorization Server(v0.0.3) built by the Spring Team. Below are the new features that have been introduced in the newer version: Enforce one-time use for authorization code Introduce OAuth2 Tokens Add Refresh Token grant Implement Token Revocation Endpoint OAuth2 is an authorization method…

Read More The New OAuth2 Authorization Server

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

In this tutorial, you will learn how to call stored procedures in a Spring Boot RESTful API project that uses Spring Data JPA. Using a stored procedure to execute parts of the application logic in the database is a widely used approach in huge, data-heavy applications. A stored procedure is a group of predefined SQL…

Read More Calling a Stored Procedure in Spring Boot REST with JPA

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

In this tutorial, you will learn how to use specification and predicate in Spring Data JPA using the Spring Boot RESTful API project. Spring Data JPA Specifications allow us to create dynamic database queries by using the JPA Criteria API. It defines a specification as a predicate over an entity. Spring has a wrapper around…

Read More Specification & Predicate: Advance Search and Filtering in JPA

This tutorial will teach you how to create your own Spring Cloud Config Server and how to configure a Spring Boot Application to be a Spring Cloud Config Client. Spring Cloud Config Server Spring Cloud Config Server is a Spring Boot application. So to create our own Spring Cloud Config Server, we must first create…

Read More Spring Cloud Config Server and Config Client

This tutorial will teach you how to create a simple Spring Cloud API Gateway Global Pre-filter and Post-filter classes. Global filters are executed for every route defined in the API Gateway. The main difference between the pre-filter and post-filter classes is that the pre-filter code is executed before Spring Cloud API Gateway routes the request to a…

Read More Spring Cloud API Gateway Global Filter Example

One way to ensure that an HTTP request to a web service endpoint contains an Authorization JWT token is to configure a gateway route to require an Authorization header.  If the HTTP request does not contain an Authorization header, Spring Cloud API Gateway will not even route this request to a destination microservice. We can…

Read More The Header Predicate in Spring Cloud API Gateway

This tutorial will teach you how to configure your Spring Cloud API Gateway to automatically create routes based on services registered with discovery clients like Eureka, Consul, or Zookeeper. For a step-by-step series of video lessons, please check this page: Spring Boot Microservices and Spring Cloud. Enable Discovery Locator A quick way to enable Spring Cloud…

Read More Spring Cloud API Gateway Automatic Mapping of Routes

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