Home > Spring

Spring

Set globally multiple header parameters in Swagger

swagger

In this article, we will learn how to set multiple header parameters globally in a Spring Boot application. Why do we need it? There are cases where we want the client to send multiple header parameters along with the one auth token, these parameters may be useful to validate the token or may be required along with the token to ... Read More »

CVE-2022-22965 SpringShell Vulnerability

spring

SpringShell is a new Spring Framework Remote Code Execution (RCE), aka¬†CVE-2022-22965, security vulnerability. Essentially all versions of the Spring Framework, including 5.3.0 to 5.3.17, 5.2.0 to 5.2.19, and older, unsupported versions are vulnerable. Check if your Spring application is Vulnerable? If you are using JDK 9 or higher. If you are using Apache Tomcat as the Servlet container. If your ... Read More »

Spring WebFlux & Reactive MongoDB

reactive spring

In this article, I will be providing a step-by-step guide to developing the Spring WebFlux RestFul API using a reactive programming approach along with Reactive MongoDB. Spring WebFlux is the spring framework step towards the reactive programming model. It uses Reactor to support the Reactive Streams API and runs on the netty server. Here we will be using Reactive MongoDB ... Read More »

Spring4Shell Vulnerability – Spring Core RCE Vulnerability

spring

Security researchers have found a new vulnerability around Spring Core, which may cause serious damage to millions of applications over the internet. This vulnerability is been said that exists in Spring core with java version JDK9.0 and above. The bad news is no patch has been released yet by the Spring. But there are some strategies to mitigate the attack. ... Read More »

Get Client Remote Address from ServerExchange in Spring WebFlux and whitelist IP

reactive spring

Below is the Spring WebFlux code to fetch the client Remote Address from the ServerExchange object. Say, we have a scenario wherein we have to check if the API request is coming from the authorized IP address list, in the web filter we will fetch the IP address of the client and will match with the set of given IP’s ... Read More »

Spring WebFlux: WebClient Retry Strategies

reactive spring

In my last Spring WebFlux project, during the HTTP calls through WebClient, often I was not getting responses from the client. But when I tried by refreshing the page, the response was coming. There could be multiple reasons for not getting the proper response from the client, but I thought to implement retry options with WebClient. In the below, we ... Read More »

Handling Execptions Global Level in Spring Webflux REST API

reactive spring

Recently in one of my Spring Webflux project, one requirement came to handle Exceptions at Global Level. So the question is why we need global handling of exception. The benefit of handling exception at global level is, we can maintain proper error code at one level, this way we will be avoiding duplicate codes inside our spring webflux REST API ... Read More »

CVE-2021-44228 Spring Boot and Log4j2 Vulnerability

spring

What is CVE-2021-44228? CVE-2021-44228 is a vulnerability impacting all the applications written in Java and using the component Apache Log4j2 for logging. This vulnerability allows the unauthenticated remote code execution using the JNDI Lookup. Log4j2 is widely used directly or through dependencies in almost every Java application. These application includes almost all the enterprise level application and almost all the ... Read More »

Enable the access logs in Spring Boot for embedded tomcat server

spring

Access logs contains the information about the request received and response sent to the client. It contains all the important data which are required to analyze the type of request coming to the application. Below are the steps which is required to configure the tomcat access logs for the Spring Boot application. Settings in application.properties file These are the common ... Read More »

Create a custom favicon in Spring Boot application

spring

In this article, we will learn how to configure custom favicon in the spring boot application. Favicon is the iconic representation of any website. It is placed in the address bar of any web browser. Spring boot provides option to create custom favicon for your website. First create a favicon for your website, place it in the resources directory of ... Read More »