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 short tutorial, you will learn how to configure the /logout functionality in your Spring Boot Web application that uses OAuth2 Social Login. To learn how to implement the OAuth2 Social login feature, please check the following tutorial: Spring Security OAuth 2 Social Login. Configure HttpSecurity Applications that use Spring Security and OAuth2 Social login…

Read More Spring Security OAuth 2 Social Logout

In this tutorial, you will learn how to add a Social Login(OAuth 2) feature into your Spring MVC Web application. This will allow users to login to your application with their social network accounts like Facebook, Google, or other large services that support OAuth 2 like for example GitHub. Spring Security 5 offers very good…

Read More Spring Security OAuth 2 Social Login

The main difference between the “mvn package” and “mvn install” commands is that mvn package command will compile the source and will package it in its distributable formats, such as a JAR or WAR. The mvn install command, however, additionally to compiling the source code and packaging it into a JAR or a WAR, it will also install the…

Read More Difference Between “mvn package” and “mvn install”

In this tutorial, you will learn how to get the currently authenticated principal user UserId value from the JWT access token generated by Keycloak. UserId in JWT The userId value will be stored under the “sub” key in the JWT access token generated by Keycloak. Below is an example of a decoded JWT access token containing…

Read More Get UserId from Keycloak JWT Access Token

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

Free Video Lessons

Enter your email and stay on top of things,

Subscribe!