Tagged articles
ResponseBodyAdvice
59 articles · Page 1 of 1
This article demonstrates how to build one Spring Boot 3.5.0 REST endpoint that automatically returns different JSON fields for desktop, mobile, tablet, and unknown clients by combining classpath scanning, a custom ResponseBodyAdvice, Jackson @JsonFilter, and YAUAA user-agent parsing.
Dynamic field filteringJackson JsonFilterMulti-device API
0 likes · 9 min read

This article walks through designing a clean, unified API response format with categorized error codes, then shows how to automate response wrapping in Spring Boot using a custom @ResponseResult annotation, a handler interceptor, and ResponseBodyAdvice so controllers return plain domain objects while the framework handles consistent JSON serialization.
@ControllerAdviceAPI DesignCustom Annotation
0 likes · 9 min read

This article walks through building a reusable SpringBoot starter that automatically encrypts response data and decrypts request payloads using hutool‑crypto, request/response body advice, and a reusable request‑stream wrapper, eliminating repetitive security code.
Custom StarterRequestBodyAdviceResponseBodyAdvice
0 likes · 17 min read

The article shows how overusing ResponseEntity in Spring Boot controllers makes code noisy and mixes business logic with HTTP handling, and introduces four declarative alternatives—@ResponseStatus on methods or exceptions, direct object returns, global ProblemDetail via @ControllerAdvice, and a ResponseBodyAdvice wrapper—to produce cleaner, more testable APIs.
@ControllerAdviceAPI DesignProblemDetail
0 likes · 16 min read

The article explains why inconsistent API responses hurt front‑end/back‑end projects, introduces a unified result object, and demonstrates four zero‑intrusion, low‑level techniques—custom ResponseBodyAdvice, return‑value handler, HandlerMethod adapter, and message converter—each with code samples and verification screenshots.
Custom Message ConverterHandlerMethodReturnValueHandlerJava
0 likes · 9 min read

This guide shows how to mask sensitive fields like phone numbers and ID cards in Spring Boot responses without modifying business code, using a global ResponseBodyAdvice, JsonPath rules defined in application.yml, and optional custom @Masking annotation for fine-grained control.
Custom AnnotationJSONPathJackson
0 likes · 9 min read

The article explains why unifying API return formats in Spring Boot prevents front‑end confusion, introduces a simple Result wrapper with code/message/data, shows manual and automatic (ResponseBodyAdvice) usage, and offers practical tips for clean, predictable backend contracts.
API responseJavaResponseBodyAdvice
0 likes · 5 min read

This article shows how to replace static DTO definitions with a zero‑intrusion, high‑concurrency solution for column‑level data masking in Spring Boot 3.5.0 by leveraging Jackson's serialization pipeline, a global Mixin, custom annotations, a contextual serializer, and a ResponseBodyAdvice that respects request‑scoped permissions.
DTOJacksonResponseBodyAdvice
0 likes · 10 min read


java1234Apr 30, 2026 · Backend Development
The article explains how to refactor Spring controller code by introducing a unified response structure, using ResponseBodyAdvice for automatic wrapping, fixing String conversion issues through message‑converter ordering, applying JSR‑303 validation (including custom validators), and implementing custom exceptions with a global exception handler, resulting in concise, maintainable backend APIs.
ControllerExceptionHandlingResponseBodyAdvice
0 likes · 18 min read

This guide shows how to configure Spring Boot to automatically wrap all controller responses in a unified Result object, apply global JSON formatting for dates, Long values, null handling, and custom enum serialization using HttpMessageConverter, ResponseBodyAdvice, and a global exception handler.
Global Exception HandlingHttpMessageConverterJSON Formatting
0 likes · 7 min read

This article explains how to redesign Spring MVC controllers by extracting common responsibilities, defining a standard response wrapper, using ResponseBodyAdvice for automatic packaging, handling String return types, and implementing comprehensive validation and custom exception handling to produce clean, maintainable backend code.
ControllerRESTResponseBodyAdvice
0 likes · 17 min read

This tutorial demonstrates how to implement global API encryption in Spring Boot using @ControllerAdvice and ResponseBodyAdvice with AES, covering step-by-step code, three critical pitfalls to avoid, and performance benchmarks showing AES adds only ~6ms overhead per request.
@ControllerAdviceAES encryptionAPI Security
0 likes · 11 min read

This article explains how to redesign Spring MVC controllers by introducing a unified response wrapper, leveraging ResponseBodyAdvice for automatic packaging, fixing String conversion issues, applying JSR‑303 validation with custom rules, and implementing global exception handling to keep controller code clean and maintainable.
ControllerException HandlingResponseBodyAdvice
0 likes · 20 min read

This article explains why masking sensitive data such as ID numbers, phone numbers, and bank cards is essential, then demonstrates five practical Spring Boot 3 solutions—including custom JsonSerializer, Jackson modules, AOP, ResponseBodyAdvice, and JsonFilter—complete with code examples and output screenshots.
AOPJacksonResponseBodyAdvice
0 likes · 8 min read

This article explains why the Controller layer remains essential in modern Spring applications, identifies common problems such as tangled validation and inconsistent responses, and demonstrates how to introduce a unified result structure, use ResponseBodyAdvice for automatic wrapping, fix String conversion issues, apply JSR‑303 validation, create custom validators, and handle exceptions uniformly.
ControllerExceptionHandlingResponseBodyAdvice
0 likes · 22 min read

This article explains why controllers are essential yet often over‑engineered, identifies common problems such as tangled validation and inconsistent responses, and demonstrates how to unify return structures, handle String conversion, apply JSR‑303 validation, create custom validators, and centralize exception handling using Spring Boot features.
ControllerException HandlingJava
0 likes · 19 min read

This article shows how to refactor SpringBoot controller code by introducing a unified Result wrapper, ResponseBodyAdvice, proper HttpMessageConverter ordering, JSR‑303 validation (including custom validators), and centralized exception handling, resulting in concise, maintainable backend code with consistent API responses.
ControllerExceptionHandlingResponseBodyAdvice
0 likes · 17 min read

This article explains how to design Spring MVC controllers with a unified response structure, implement request validation using JSR‑303 and custom annotations, handle exceptions uniformly, and resolve issues with ResponseBodyAdvice and HttpMessageConverters to improve code clarity and maintainability.
ControllerException HandlingJava
0 likes · 18 min read

This article explains the essential responsibilities of a Spring MVC controller, identifies common pitfalls such as duplicated validation and inconsistent responses, and demonstrates how to unify response structures, handle String conversion issues, apply JSR‑303 validation, create custom validators, and implement centralized exception handling using ResponseBodyAdvice and @RestControllerAdvice.
ControllerExceptionHandlingResponseBodyAdvice
0 likes · 17 min read

This article outlines a four‑step approach to refactor Spring MVC controllers by unifying response structures, centralizing response wrapping via ResponseBodyAdvice, implementing robust parameter validation with JSR‑303, and handling custom exceptions globally, resulting in cleaner, more maintainable backend code.
ControllerResponseBodyAdviceSpring MVC
0 likes · 18 min read

This article explains how to refactor Spring MVC controllers by introducing a unified response wrapper, using ResponseBodyAdvice for automatic packaging, handling String conversion issues, applying JSR‑303 validation for request parameters, creating custom validators, and defining centralized exception handling to keep controller code clean and maintainable.
ControllerExceptionHandlingJava
0 likes · 17 min read

This article explains how to refactor the Spring MVC Controller layer by unifying response structures, using ResponseBodyAdvice for automatic wrapping, handling parameter validation with JSR‑303, and implementing custom exceptions with centralized exception handling to simplify and standardize API responses.
Exception HandlingJavaResponseBodyAdvice
0 likes · 17 min read

This article explains how to refactor the Spring MVC Controller layer by standardizing response structures, implementing unified response wrapping via ResponseBodyAdvice, handling String conversion issues, applying JSR‑303 parameter validation, creating custom validation rules, and defining custom exceptions with centralized exception handling to simplify controller code.
ControllerJavaResponseBodyAdvice
0 likes · 17 min read

This article explains why Controllers are essential in Spring MVC, identifies common problems such as tangled validation and inconsistent responses, and demonstrates how to introduce a unified return structure, use ResponseBodyAdvice for automatic wrapping, handle String conversion issues, apply JSR‑303 validation, create custom validators, and centralize exception handling to produce cleaner, more maintainable backend code.
ControllerExceptionHandlingResponseBodyAdvice
0 likes · 19 min read

The article analyzes the role of Spring MVC Controllers, identifies issues with traditional implementations, and demonstrates how to create a unified response structure, automatically wrap results using ResponseBodyAdvice, resolve String conversion problems, and apply JSR‑303 validation with custom rules and global exception handling.
BackendControllerException Handling
0 likes · 22 min read

The article presents a step‑by‑step guide to refactor Spring MVC controller code by unifying response formats, applying a global response wrapper, enforcing parameter validation with JSR‑303, and handling custom exceptions through a centralized advice, all illustrated with complete Java examples.
ControllerExceptionHandlingJava
0 likes · 18 min read

This article explains the essential duties of a Spring MVC Controller, identifies common pitfalls such as duplicated validation and inconsistent responses, and demonstrates how to introduce a unified result wrapper, ResponseBodyAdvice, proper message‑converter ordering, JSR‑303 validation, custom validators, and global exception handling to produce concise, maintainable backend code.
ControllerException HandlingJava
0 likes · 19 min read

This article explains the JSONP technique, demonstrates how to implement it in Spring Boot with a simple REST endpoint, custom JSONP wrapper, ResponseBodyAdvice, and a customized HttpMessageConverter, and shows how to test the solution using HTML script tags.
Cross-OriginHttpMessageConverterJSONP
0 likes · 9 min read

This article explains the role of Controllers in Spring Boot, identifies common pitfalls such as duplicated validation and inconsistent responses, and demonstrates how to refactor them using a unified response structure, ResponseBodyAdvice, proper message converter ordering, JSR‑303 validation, custom validators, and centralized exception handling.
ControllerException HandlingResponseBodyAdvice
0 likes · 19 min read

This tutorial explains how to create a global response wrapper in Spring Boot 3.2.5 using ResponseBodyAdvice, covering the pros and cons of controller‑level wrapping, custom annotations, code examples, handling of String responses, and testing the unified output with sample requests.
API wrapperResponseBodyAdviceSpring Boot
0 likes · 10 min read

This article explains the purpose, core methods, and practical implementation of Spring MVC’s RequestBodyAdvice and ResponseBodyAdvice extension points, including code examples for request decryption, signature verification, response encryption, unified result wrapping, and the underlying request‑processing flow within the framework.
API SecurityRequestBodyAdviceResponseBodyAdvice
0 likes · 23 min read

This article explains how to design a clean Controller layer in Spring Boot, introduces a unified response format with Result and ResponseBodyAdvice, demonstrates parameter validation using JSR‑303 and Spring Validation, and shows custom validation annotations and global exception handling to keep controller code concise and maintainable.
ControllerException HandlingJava
0 likes · 18 min read

This article explains how to build a clean, maintainable Controller layer in Java Spring by separating responsibilities, using unified response structures, applying ResponseBodyAdvice for automatic wrapping, implementing parameter validation with JSR‑303, and handling custom exceptions through centralized advice, illustrated with comprehensive code examples.
ControllerExceptionHandlingJava
0 likes · 15 min read

This article explains how to protect sensitive fields in SpringBoot 2.7 by using a custom annotation with AOP or a ResponseBodyAdvice implementation, comparing their advantages, showing complete code examples, and highlighting performance considerations for symmetric AES encryption.
ResponseBodyAdviceSpringBootencryption
0 likes · 7 min read

This article explains how to build a reusable Spring Boot starter that automatically encrypts outgoing responses and decrypts incoming requests using hutool‑crypto, custom request wrappers, validation utilities, and Spring Boot advice components, providing a secure, zero‑boilerplate solution for Java backend services.
BackendJavaRequestBodyAdvice
0 likes · 21 min read

This article explains how to build a reusable Spring Boot starter that automatically encrypts response data and decrypts request payloads using Hutool-Crypto's AES utilities, covering request stream handling, validation, custom starter configuration, and example code for controllers and entities.
AESHutoolRequestBodyAdvice
0 likes · 23 min read

This guide explains how to use Spring's ResponseBodyAdvice to create a unified response wrapper for RESTful APIs, improving consistency, readability, and extensibility while handling common pitfalls such as String return type errors.
API standardizationJavaResponseBodyAdvice
0 likes · 6 min read

This article demonstrates how to implement unified user login permission checks, centralized exception handling, and consistent response formatting in Spring Boot using AOP, HandlerInterceptor, @ControllerAdvice, and ResponseBodyAdvice, providing step‑by‑step code examples and configuration details.
AOPException HandlingInterceptor
0 likes · 12 min read

This article explains how to design a clean, maintainable Spring MVC controller layer by unifying response structures, applying centralized exception handling, and leveraging JSR‑303 validation with custom rules, illustrated with comprehensive code examples and best‑practice guidelines.
ControllerJavaResponseBodyAdvice
0 likes · 18 min read

This article explains how to standardize API return formats with a generic Result object, define error codes and custom exceptions, implement a global exception handler, use ResponseBodyAdvice for automatic response wrapping, and package these utilities into a reusable Spring Boot starter for cleaner backend code.
Global ExceptionResponseBodyAdviceResult Wrapper
0 likes · 14 min read

This article explains how to redesign Spring MVC controllers by introducing a unified response structure, leveraging ResponseBodyAdvice for automatic wrapping, handling String conversion issues, applying JSR‑303 validation, creating custom validators, and centralizing exception handling to produce cleaner, more maintainable backend code.
BackendJavaResponseBodyAdvice
0 likes · 20 min read

This article explains how to refactor a Spring MVC Controller layer by introducing a unified response format, leveraging ResponseBodyAdvice for automatic wrapping, applying JSR‑303 validation for request parameters, and centralizing exception handling to produce clean, maintainable backend code.
ControllerExceptionHandlingJava
0 likes · 17 min read

The article explains how Spring Boot projects can adopt a standard JSON response structure using a generic ResponseVO class and achieve automatic wrapping and global exception handling through a custom @ResponseResultBody annotation combined with ResponseBodyAdvice and @ControllerAdvice, reducing repetitive code and improving robustness.
Global Exception HandlingResponseBodyAdviceResponseVO
0 likes · 14 min read

This article explains how to redesign Spring MVC controllers by introducing a unified Result wrapper, using ResponseBodyAdvice for automatic response packaging, applying JSR‑303 validation on DTOs and method parameters, and handling custom exceptions globally to produce consistent API outputs.
ControllerJavaResponseBodyAdvice
0 likes · 17 min read

This article explains why traditional Spring MVC Controllers become cumbersome, demonstrates how to unify response structures with a Result wrapper, leverages ResponseBodyAdvice for automatic packaging, resolves String conversion issues, and shows best‑practice parameter validation using JSR‑303, custom validators, and global exception handling to keep controller code clean and maintainable.
ControllerJavaResponseBodyAdvice
0 likes · 20 min read

This article explains how to refactor a Spring MVC Controller layer by defining its responsibilities, introducing a unified response format, using ResponseBodyAdvice for automatic wrapping, applying JSR‑303 validation for request parameters, and implementing custom exceptions with centralized handling to achieve cleaner, more maintainable backend code.
ControllerExceptionHandlingResponseBodyAdvice
0 likes · 17 min read

This article explains why the Controller layer should stay thin, identifies common pitfalls such as tangled validation and inconsistent responses, and demonstrates how to introduce a unified result wrapper, global response advice, robust parameter validation, custom validators, and centralized exception handling to produce concise, maintainable backend code.
ControllerException HandlingJava
0 likes · 17 min read

This article demonstrates how to create a custom Spring Boot starter that provides automatic request body decryption and response body encryption using Hutool‑crypto, HttpServletRequestWrapper, RequestBodyAdvice, ResponseBodyAdvice, and validation utilities, enabling secure data transmission with timestamp verification.
JavaRequestBodyAdviceResponseBodyAdvice
0 likes · 25 min read

This article explains how to improve the Controller layer in Spring applications by separating responsibilities, implementing unified response structures with Result wrappers, handling String response issues via ResponseBodyAdvice, applying parameter validation with JSR‑303, customizing validators, and centralizing exception handling for cleaner, more maintainable backend code.
ControllerExceptionHandlingJava
0 likes · 18 min read

This article explains how to refactor Spring MVC Controller code by introducing a unified response format, handling String and JSON return types with ResponseBodyAdvice, applying parameter validation using JSR‑303, and implementing custom exceptions with centralized exception handling to simplify business logic and improve code maintainability.
ControllerExceptionHandlingResponseBodyAdvice
0 likes · 20 min read

This article explains how to design a clean Controller layer in Spring MVC by implementing unified response structures, handling String response issues with ResponseBodyAdvice, applying parameter validation with JSR‑303, and creating custom exceptions with centralized exception handling to simplify business logic.
ControllerException HandlingJava
0 likes · 19 min read

This article explains how to improve Spring MVC controller logic by separating responsibilities, introducing a unified response structure, handling String return types with ResponseBodyAdvice, applying JSR‑303 validation, creating custom validators, and using custom exceptions with global exception handling to produce concise and maintainable backend code.
ControllerExceptionHandlingJava
0 likes · 18 min read

This article explains why the Controller layer is essential, identifies common pitfalls such as tangled validation and inconsistent responses, and demonstrates how to refactor Spring MVC controllers using a unified Result wrapper, ResponseBodyAdvice, proper String handling, JSR‑303 validation, custom validators, and global exception handling to produce clean, maintainable backend code.
BackendControllerResponseBodyAdvice
0 likes · 21 min read

This article explains how to implement a unified response format and centralized exception handling in Spring Boot applications using @RestControllerAdvice, @ControllerAdvice, ResponseBodyAdvice, and custom response entities, providing code examples and best‑practice guidelines for robust backend APIs.
Exception HandlingGlobal ResponseResponseBodyAdvice
0 likes · 13 min read

This article explains how to design a dictionary entity, create a custom annotation, and use Spring's ResponseBodyAdvice together with Java reflection to automatically convert enum values to their textual representations in API responses, improving front‑end display without manual mapping.
BackendDictionary MappingJava
0 likes · 7 min read

This article examines three frequent challenges when using Feign in Spring Cloud—where to place the client, whether to wrap Feign interfaces, and how to handle business exceptions—offering a detailed comparison of two call styles, a ResponseBodyAdvice‑based wrapper solution, and a custom error decoder to propagate original exceptions.
Exception HandlingFeignResponseBodyAdvice
0 likes · 13 min read

This tutorial explains why a consistent response wrapper is needed in SpringBoot, shows how to define a standard JSON format with status, message and data fields, and demonstrates using ResponseBodyAdvice and a global exception handler to automatically wrap successful and error results.
GlobalExceptionHandlingJavaResponseBodyAdvice
0 likes · 11 min read

This article explains how to design a non‑intrusive unified JSON response structure for Spring MVC applications, defines the standard JSON schema, provides Java enums and generic Result classes, demonstrates usage with @ResponseResultBody and @RestControllerAdvice, and shows comprehensive exception handling techniques.
BackendJSONJava
0 likes · 12 min read

This tutorial explains why a unified JSON format is needed in a Spring Boot project, defines a standard {code, message, data} schema, shows how to create a Result enum and generic wrapper class, and demonstrates global handling with @ResponseResultBody, ResponseBodyAdvice, and @ExceptionHandler for clean, consistent API responses.
BackendException HandlingJSON response
0 likes · 14 min read
