Spring Boot

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, you must have followed the previous one and must have knowledge on how to develop a REST Controller in a…

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

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

In this tutorial, the reader will learn how to deploy a Spring Boot REST app to Tomcat 10. According to Apache, the Jakarta EE platform is the evolution of the Java EE platform. Tomcat 10 and later implement specifications developed as part of Jakarta EE. Tomcat 9 and earlier implement specifications developed as part of…

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

In this tutorial on Spring Cloud you will learn how to create your own Spring Cloud Config Server and also, 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…

Read More Spring Cloud Config Server and Config Client

In this tutorial, you will learn how to start your Spring Boot application on a random port number. This is very helpful when you need to start multiple instances of the same Spring Boot application and then balance HTTP requests between the running instances. If you are interested to learn how to balance HTTP requests…

Read More Start Spring Boot App on a Random Port Number

In this tutorial, you will learn how to start your Spring Boot Web application on a different port number. By default, if no port number is configured, our Spring Boot Web application will start on port number 8080. To configure a different port number, you will need to update an application.properties file with the following…

Read More Start Spring Boot App on a Different Port Number

In this tutorial, you will learn 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…

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 app, at runtime, to use a different logging level. Set Logging Level for a Package in Your App Let’s assume we have a Spring Boot Web Application with the following method in a Rest Controller class. @RestController @RequestMapping(“/users”)…

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 representation. But we can easily make our RESTful Spring Boot Web service endpoints consume and produce an XML representation of a resource as well. Add XML Support to Spring Boot Project To make our Spring Boot project consume and produce an XML representation…

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

In this tutorial, you will learn how to create an instance of @LoadBalanced RestTemplate and make it communicate with an internal microservice. For a step by step series of video lessons, please check this page: Spring Boot Microservices and Spring Cloud. Create RestTemplate Bean To create an instance of RestTemplate, you will need to first…

Read More @LoadBalanced RestTemplate Call Internal Microservice

In this Spring Security tutorial, you will learn how to use the @PreAuthorize annotation to secure method invocation. You can use the @PreAuthorize annotation to secure either method in a Controller class or a method in a service layer class. There are other useful method level security annotations like the ones below. It is useful…

Read More Spring Security @PreAuthorize Annotation Example

Free Video Lessons

Enter your email and stay on top of things,

Subscribe!