Posts

Copying MDC Context Map in Web Clients: A Comprehensive Guide

Image
Introduction In distributed systems, maintaining context across microservices is crucial for effective logging and tracing. The Mapped Diagnostic Context (MDC) in logging frameworks like Logback or Log4j allows developers to propagate contextual information such as request IDs, user IDs, or correlation IDs across threads and services. When using web clients to make outgoing requests, it's essential to propagate the MDC context map to ensure consistency and traceability. This guide will provide   ...

Configuring Web Security in Spring Web and Spring WebFlux with Spring Boot 3.x and Java 17

Image
Team is proactively working on spring boot 3.x upgrade and java 17. this post guide you how to migrate those Web Security Config in both Spring Web and Spring WebFlux. Securing web applications is a critical aspect of modern software development. In Spring applications, configuring web security is made easy with the powerful Spring Security framework. With the release of Spring Boot 3.x and Java 17, developers can leverage the latest features and improvements for building secure web application   ...

Implementing Filters in Spring Web and Spring WebFlux

Image
Introduction Team is proactively working on spring boot 3.x upgrade and java 17. this post guide you how to migrate those Filters in both Spring Web and Spring WebFlux. Filters are a fundamental aspect of web development, allowing developers to intercept and manipulate incoming requests and outgoing responses. In Spring applications, filters can be implemented to perform tasks such as logging, authentication, authorization, and request/response modification. This guide will demonstrate how to   ...

A Comprehensive Guide to Context Path Configuration in Spring Web and Spring WebFlux

Image
Introduction Team is working on spring boot version upgrade to 3.x and java to java 17. We noticed a few changes required for Context Path. The context path plays a crucial role in web applications, serving as the prefix to all URLs within the application. Configuring the context path correctly is essential, especially in scenarios where multiple applications are deployed on the same server. In this guide, we'll explore how to configure the context path in both Spring Web and Spring WebFlux app   ...

A Comprehensive Guide to Using H2 In-Memory Database in Unit Tests

Image
Introduction Unit testing is an integral part of software development, ensuring that individual components of an application function as expected in isolation. When testing components that interact with databases, using an in-memory database is a common approach to achieve fast and reliable tests. In this guide, we'll explore how to use the H2 in-memory database in your unit tests with Spring Boot. Step 1: Add H2 Dependency First, ensure that you have the H2 database dependency added to your   ...