Introduction Here in this example, I am going to show you how to create Spring Boot profile based logging. For any applications logging is an important things which will help you to debug through your application errors or issues and you can fix them easily by analyzing those errors or issues from the log files….

Posted in Log4J Spring Boot

Spring Boot Profile Based Logging

Introduction In this example I am going to show you how to start your spring boot application on HTTPS protocol. HTTPS is a secured protocol, whereas HTTP is unsecured protocol. So the data passed over the network using HTTPS protocol are generally encrypted data. The application which I am going to build is in the…

Posted in Security Spring Boot Spring MVC

Spring Boot Application Over HTTPS

Introduction In this example I am going to show you Spring Security Pre-authentication hasrole with Spring Data JPA. In my another example I had shown the similar example on Spring Security Pre-Authentication with Spring JDBC Template. There are situations where you want to use Spring Security for authorization, but the user has already been reliably…

Posted in Spring Boot Spring REST Spring Security

Spring Security Pre-Authentication with Spring Data JPA

Introduction Here I am going to build a system to log online user activity in Spring Boot applications using HandlerInterceptor interface. As an application owner you may want to track your user activities, such as, which page they are accessing, from where requests were made to your application, from which pages to which pages they…

Posted in Spring Boot Spring JPA Spring REST

How To Log Online User Activity In Spring Boot Applications

Introduction In this tutorial I am going to show you how to call Spring REST APIs concurrently using Java CompletableFuture. So basically REST service APIs will be invoked parallelly and in parallel execution the response time will be very less. I am going to show you how to call REST APIs concurrently using Java 8…

Posted in Microservices Spring Boot Spring REST

How To Call Spring REST APIs Concurrently using Java CompletableFuture

Table of Contents Introduction Prerequisites Download Large File Using WebClient Using RestTemplate Testing the APplication Source Code Introduction Here in this tutorial I am going to show you how to download large file using Spring REST API. Generally when you download a file, your file is stored into file system or you load it into…

Posted in Spring Boot Spring REST

Download Large File using Spring REST API

Introduction Here in this tutorial I am going to show you how to use AJAX technique using jQuery with Spring Boot application to check user availability instantly without refreshing the web page. I am going to use Thymeleaf template in Spring Boot application. I will use Spring REST to create REST API endpoint which will…

Posted in AJAX jQuery Spring Boot Spring REST

Spring Boot AJAX jQuery to check User Availability Instantly

Spring Cloud Gateway Security In this tutorial I am going to show you an example on Spring Cloud Gateway Security with JWT. JSON Web Tokens (JWT) are an open, industry standard RFC 7519 method for representing claims securely between two parties. JWT.IO allows you to decode, verify and generate JWT. The Spring Cloud Gateway sits…

Posted in Spring Boot Spring Cloud Spring REST Spring Security Spring WebFlux

Spring Cloud Gateway Security with JWT (JSON Web Token)

In this tutorial I am going to explain how to start Spring Cloud microservices on random ports. If you do not specify any port for each of your Spring Boot services, then they will run on the same port and only one application will start and rest of the applications will fail to start. One…

Posted in Microservices Spring Boot Spring Cloud

Spring Cloud Microservices Discovery with Eureka on Random Ports

Introduction The ELK Stack is made of three open-source products: 1) Elasticsearch, 2) Logstash, and 3) Kibana. Elasticsearch: It is a NoSQL database which is based on the open-source search engine called Lucene. So Elasticsearch is a search and analytics engine. Logstash: It is a data processing pipeline tool which accepts inputs from (multiple) sources,…

Posted in Log4J Spring Boot

ELK Stack Integration with Spring Boot Applications

Introduction Here in this tutorial I will show you an example on how to test private methods using Junit framework. I am using Junit 5 framework to test the private method. Using Mockito framework you won’t be able to test private methods, but using PowerMock core API you will be able to test the private…

Posted in Junit Spring Boot

How to test Private Methods using Junit 5

In this tutorial I am going to show you how lookup method injection works in Spring framework. You may face a situation where you need to inject prototype scoped bean into singleton scoped bean. For singleton scoped bean a new instance or object is created and the same is returned each time it is injected…

Posted in Spring Boot Spring Core

Inject Prototype Bean into Singleton Bean in Spring – Lookup Method Injection