BACKEND(spring-microservice)

This category is for posts related to Spring, Spring Boot, and Spring-based microservices.

Complete Guide to Exception Handling in RESTful API Microservices

Building robust exception handling in microservices requires more than just try-catch blocks. This comprehensive guide covers AdventureTube’s proven three-layer approach to exception management, implemented in production microservices handling millions of requests. ## 🎯 Who This Guide Is For – **Spring Boot developers** building or maintaining microservices – **Backend engineers** struggling with inconsistent error handling – […]

Complete Guide to Exception Handling in RESTful API Microservices Read More »

Exception Handling

[MERGED] Controller vs Service Exception Handling

## This Content Has Been Merged This post has been merged into our comprehensive exception handling guide for better organization and completeness. ### 👉 **Read the Complete Guide:** **[Complete Guide to Exception Handling in RESTful API Microservices](https://adventuretube.net/complete-guide-to-exception-handling-in-restful-api-microservices/)** The complete guide now includes: – **Part 1**: Foundation – HTTP Mapping & Priority Order (from this post)

[MERGED] Controller vs Service Exception Handling Read More »

Exception Handling

[MERGED] Client/Server Exception and Success Mapping

## This Content Has Been Merged This post has been merged into our comprehensive exception handling guide for better organization and completeness. ### 👉 **Read the Complete Guide:** **[Complete Guide to Exception Handling in RESTful API Microservices](https://adventuretube.net/complete-guide-to-exception-handling-in-restful-api-microservices/)** The complete guide now includes: – **Part 1**: Foundation – HTTP Mapping & Priority Order (from this post)

[MERGED] Client/Server Exception and Success Mapping Read More »

Exception Handling

[MERGED] Exception Architecture in Adventuretube Microservices

## This Content Has Been Merged This post has been merged into our comprehensive exception handling guide for better organization and completeness. ### 👉 **Read the Complete Guide:** **[Complete Guide to Exception Handling in RESTful API Microservices](https://adventuretube.net/complete-guide-to-exception-handling-in-restful-api-microservices/)** The complete guide now includes: – **Part 1**: Foundation – HTTP Mapping & Priority Order – **Part 2**:

[MERGED] Exception Architecture in Adventuretube Microservices Read More »

Exception Handling

How Spring Security Authentication Flow Has Been Implemented in AdventureTube auth-service Module

  1. 🎯 Purpose This document explains how Spring Security’s authentication flow is custom-configured and used inside the auth-service module of the AdventureTube microservices system, especially for authenticating users via Google ID tokens. 2. 🔐 Authentication Scenario The only point where authentication is explicitly triggered is during POST /auth/issueToken. This endpoint receives a valid Google

How Spring Security Authentication Flow Has Been Implemented in AdventureTube auth-service Module Read More »

Spring Security

Understanding Spring Test Types in Microservice Projects

Understanding Spring Test Types in Microservice Projects In a real-world Spring Boot microservice architecture, choosing the right kind of test can drastically affect test speed, confidence, and maintainability. This guide breaks down key test types used in Spring applications, their purposes, and best practices. ✅ 1. Unit Test (Pure Java) Purpose: Test a single class/method

Understanding Spring Test Types in Microservice Projects Read More »

Testing

Custom Spring Security Test in Spring Boot

When writing tests for Spring Security, it’s important to align your test scope with the actual application flow. Here’s how to test your CustomUserDetailService correctly in a Spring Boot microservices setup that communicates with another service via RestTemplate and is wired into the AuthenticationManager. ✅ Why Testing AuthenticationManager Is Better Than Calling loadUserByUsername() Calling authenticationManager.authenticate(…):

Custom Spring Security Test in Spring Boot Read More »

Spring Security

How Spring Config Server and .env Collaborate in Multi-Env Microservices

In the AdventureTube backend microservices architecture, configuration management is handled through a collaboration between Spring Cloud Config Server and environment (.env) files. This setup ensures consistency, flexibility, and secure handling of configuration data across different stages of deployment. 🧩 Background of env.XXX File Design The original idea behind creating env.XXX files was for Docker-based environments,

How Spring Config Server and .env Collaborate in Multi-Env Microservices Read More »

Spring Cloud

MapStruct Debug in Microservice

1. Configuration in Microservice For MapStruct to function properly within a Spring Boot microservices architecture, both the parent and sub-module pom.xml files must be correctly configured: Parent pom.xml <dependencyManagement> <dependencies> <dependency> <groupId>org.mapstruct</groupId> <artifactId>mapstruct</artifactId> <version>1.5.5.Final</version> </dependency> </dependencies> </dependencyManagement> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.10.1</version> <configuration> <annotationProcessorPaths> <path> <groupId>org.mapstruct</groupId> <artifactId>mapstruct-processor</artifactId> <version>1.5.5.Final</version> </path> <path> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>1.18.30</version> </path>

MapStruct Debug in Microservice Read More »

Spring Boot

Adventuretube REST API Architecture Principle

1. Correct Design of Controller and Service Principle: Thin Controller, Fat Service Controllers should only handle HTTP concerns: routing, request/response formatting, and returning status codes. Services should encapsulate business logic, including all validations and error throwing. Why This Matters 1. Separation of Concerns Layer Responsibility Controller Handle HTTP interface Service Contain domain logic and validation

Adventuretube REST API Architecture Principle Read More »

API Design