Spring Boot

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

In this tutorial, you will learn how to make Zuul API Gateway pass an Authorization header to a downstream Microservice. To learn how to make Spring Boot Microservice read HTTP Request headers, please read this tutorial: Read HTTP Request Header in Spring MVC. Configure Zuul API Gateway to Forward an Authorization Header By default, Zuul…

Read More Pass Authorization Header to Downstream Microservice

In this tutorial, I am going to share with you how to generate a self-signed certificate and enable HTTPs/SSL support in a Spring Boot application. You will also learn how to configure RestTemplate HTTP client to use the same self-signed certificate to communicate with your Web Service over HTTPs. Let’s start by generating a self-signed…

Read More Enable HTTPs/SSL in Spring Boot App

In this Spring Boot tutorial, you will learn how to get the details of the currently authenticated principal user. There is more than one way to get currently authenticated user details and in this blog post, I am going to share with you a few. Most likely you already have Spring Security configured for your…

Read More Spring Security. Get Authenticated Principal Details.

In this Spring Boot Security tutorial, you will learn how to use Spring method-level security to secure RestController methods with @PreAuthorize annotation. If you are interested in video lessons, then I also show how to create user Roles and Authorities and how to use Spring Method Level Security annotations in my video course: RESTful Web…

Read More Spring Method-Level Security. Secure RestController Methods

In this Spring Boot tutorial, you will learn how to create a console-based Spring Boot application which you can run in the terminal window on your computer. You will also learn how to pass command-line arguments to your Spring Boot console-based application. For more Spring Boot tutorials and also video lessons check this page: Spring…

Read More Spring Boot Console Application

In this Spring Boot Security tutorial, you will learn how to enable Basic Authentication for your Spring Boot project and how to configure the default username, password and user role. You will also learn how to secure a web service request URL so that only authenticated user with a default username, password and role can access.…

Read More Spring Security Default Username, Password, Role

In this tutorial, you will learn how to add Spring Security to your project and how to enable in-memory basic authentication. You will learn how to configure two different users with different Roles and Privileges. Both users, their roles and privileges will be stored in the memory of your application. Create a New Spring Boot…

Read More Spring Security In-Memory Authentication

In this tutorial you will learn you how to use Asymmetric Encryption(RSA key pair) to encrypt sensitive information in configuration properties served by Spring Cloud Config Server.  Asymmetric Encryption is a stronger encryption type than symmetric encryption(shared key) but it requires just a little bit more effort to set up because we need to generate an encryption…

Read More Spring Cloud Config – Asymmetric Encryption and Decryption

In this tutorial you will learn how to encrypt and decrypt a property value which is being served by Spring Cloud Config Server. The Config Server can use a symmetric (shared) key or an asymmetric one (RSA key pair). In this tutorial we will use symmetric key. For Asymmetric Encryption read this tutorial: Spring Cloud Config…

Read More Spring Cloud Config – Symmetric Encryption and Decryption

In this tutorial you will learn how to configure your Spring Cloud Config Server to use native file system as a backend. For a step by step series of video lessons, please check this page: Spring Boot Microservices and Spring Cloud. Create Spring Cloud Config Server To learn how to create your very first Spring Cloud…

Read More Spring Cloud Config Server – File System as a Backend