Basic Authentication in Spring Boot

Let’s learn how to implement Basic authentication in a Spring MVC application with an example. Configure Basic Auth To set up basic authentication, you need to provide our own HttpSecurity configuration. Similar to providing custom login form, this setup also requires a custom WebSecurityConfigurerAdapter as shown below. This is the only change that you have to do. After…

Session Tracking modes in Spring security

Applications maintain their state with the user using a concept called session. In this post we will see about different type of session tracking modes and how they work. When an application authenticates a user, it can do two possible things. Forget about the user after the request is processed and user will have to authenticate for each…

Custom Login Form in Spring Security

In this post, We will take a look at providing a custom form login in a spring boot application. The default spring boot form login may not fit everyone’s need. For example, Some organization may want to put a logo on their login page. Some may find the default login forms less appealing. For some perfectionists,…

Form Login with Spring Boot

This article concentrates on the default form login implementation from Spring Boot and Spring Security. Let’s dive in to understand spring security with form-based username and password login. To start with, I have written a simple web application with an API that prints hello world. There is nothing special about this Controller. When we open…

Spring Security

What is Spring Security? It is a powerful and highly customizable authentication and access-control(RBAC) framework. It is the standard for securing Spring-based web applications. This framework focuses on providing both authentication and authorization to Java applications. Similar to other modules, You can easily extend the Spring Security module to meet custom requirements. Features Here are…

Spring Boot Redis Cache Example

Let’s learn how to implement Redis as a cache store in spring boot with an example. Previously, We discussed how to enable caching implementation in Spring Boot using an in-memory cache manager. But, there were a few drawbacks to that approach. This is where the Redis cache store comes into the picture. Introduction Redis is…

Spring Cache For Better application performance

Let’s learn how to implement cache mechanisms in Spring Boot using @Cacheable annotation with an example. Introduction to Spring Cache abstraction Caching is a concept that improves response time by storing copies of most frequently used data on a temporary but fast storage. In this article, We will see how to enable caching for a…

Command Line Runner in Spring Boot.

In this post, We will take a look at Command line runner in Spring Boot and how to implement them properly with an example. Typical Java Implementation Let’s take a small example in pure java. The above class is an example of a command line application. The application takes two command line arguments, then calculates…

Spring Boot Banner – Complete Guide

In this post, We will learn how to customize startup banner of a spring Boot application. Also, we will understand how we can use an image or gif file as a startup banner. Take a look at our Hello World Application. As you see, the default at the spring boot startup banner looks like below….

RESTful JPA Repositories with Spring Boot

In this post we will see how to create restful endpoints from JPA Repositories in a Spring Boot application. Introduction In the HATEOAS implementation tutorial, we pretty much save and retrieve data from the database. But there is too much boilerplate code for just managing the data(Controller methods). In situations like these, Spring Data REST comes…