Category: Spring Boot
Spring Boot
Download Large File using Spring REST API
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 memory as a byte array….
Spring Boot AJAX jQuery to check User Availability Instantly
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 be called from jQuery code….
Spring Cloud Gateway Security with JWT (JSON Web Token)
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 in front of your microservices…
Spring Cloud Microservices Discovery with Eureka on Random Ports
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 way to fix this problem…
ELK Stack Integration with Spring Boot Applications
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, performs different transformations, and exports…
How to test Private Methods using Junit 5
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 methods. You can also use…
Inject Prototype Bean into Singleton Bean in Spring – Lookup Method Injection
Lookup Method 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 or looked up….
How to deal with Whitelabel Error Page in Spring Boot Applications
In this tutorial I am going to discuss about what is Whitelabel Error Page and how to deal with Whitelabel Error Page in Spring Boot applications. Spring boot allows you to setup a Spring based application with minimal configurations. Spring MVC applications provide no default (fall-back) error page out of the box but Spring Boot based applications provide a fall-back…
Spring Cloud Bus Example
Here I am going to build an application to show how to use Spring Cloud Bus. Let’s say you have multiple applications reading properties using Spring Cloud Config from centralized configuration files (for example, from Git repository). Spring Cloud Config is where you can have not only your all configurations centrally managed but also you can refresh them dynamically and…
How to deploy Spring Boot Data JPA Application to Heroku Cloud
In this tutorial I am going to show you an example on deploying Spring Boot application to Heroku cloud. I will create a basic CRUD application with Spring Boot Data JPA and PostgreSQL/MySQL technologies. I will first show you how to perform CRUD operations locally, then deploy the same application in the Heroku cloud with some modifications. CRUD is an…