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 make sure…

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 to…

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 will share how to generate a self-signed certificate and enable HTTPS/SSL support in a Spring Boot application. You will also learn how to configure the 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 certificate. Generate 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 tutorial, you will learn how to create a console-based Spring Boot application that you can run in the terminal window on your computer. You will also learn to pass command-line arguments to your Spring Boot console-based application. For more Spring Boot tutorials and video lessons check this page: Spring Boot tutorials and video lessons.…

Read More Spring Boot Console Application

In this Spring Boot tutorial, you will learn how to implement User Authentication(User Login) functionality for your RESTful Web Service application. There is also a step-by-step video demonstration on how to do User Authentication available here. The user authentication functionality we are going to implement in this tutorial will work the following way: A user…

Read More User Authentication – Spring Boot, Spring Security, JWT

In this short tutorial, you will learn how to use SearchPaths to configure your Spring Cloud Config Server to discover properties files in remote Git repository subdirectories. To learn how to configure Spring Cloud Config Server and also Spring Cloud Config Client, please read this tutorial: Learn to use Spring Cloud Config Server and Spring Cloud…

Read More Spring Cloud Config Server – SearchPaths

This tutorial will teach you how to bind nested properties from the application.properties file to a Java class. Once you finish this tutorial, you might also want to check: How to bind simple(not nested) properties to a Java class, and How to use @ConfigurationProperties with Spring Boot @Profile. Example of Nested Properties in a Properties File…

Read More Spring Boot Nested Properties with @ConfigurationProperties

In this tutorial, you will learn how to use @ConfigurationProperties with Spring Boot Profiles. This tutorial assumes you have a basic knowledge of how to use @ConfigurationProperties in your Spring Boot application. If you are very new to it, please read this tutorial: Spring Boot @ConfigurationProperties Tutorial. You should also have basic knowledge of Spring Boot…

Read More Using Spring Boot @ConfigurationProperties and @Profile

@ConfigurationProperties annotation is used to bind all the properties in a properties file to a Java class. You can then use an object of the Java class annotated with ConfigurationProperties annotation to access configuration properties defined in a properties file. Earlier I shared with you a tutorial on how to read application properties in Spring Boot RESTful…

Read More Spring Boot @ConfigurationProperties Tutorial

In this tutorial, you will learn how to use Spring Boot Profiles. You can use Spring Boot Profile functionality when providing application configuration for a specific environment. For example, when your application runs in a development environment, then your application will use a specific for that environment application.properties file. And when you are ready to…

Read More Spring Boot Profiles Tutorial

In this tutorial, you will learn how to use Spring Cloud Bus to notify running Microservices about the changes in the Spring Cloud Config property file. Running Microservices will be updated with new properties stored in Spring Cloud Config file without the need for you to restart them. This way you can update values in…

Read More Spring Cloud Bus – Refreshing Config Changes