Tagged articles
@ControllerAdvice
43 articles · Page 1 of 1
This article explains how Spring MVC's @ControllerAdvice selects exception handlers by inheritance depth, how @Order prioritizes multiple advice classes, which scope attributes limit coverage, and why Filter exceptions, 404 errors, and afterCompletion interceptor exceptions escape global handling.
@ControllerAdvice@ExceptionHandler@Order
0 likes · 17 min read

This article demonstrates how to eliminate 95% of try-catch blocks in Spring Boot by combining custom assertions with enum-based error codes, unified @ControllerAdvice exception handling, and a standardized response structure for clean, maintainable error management.
@ControllerAdviceEnum PatternException Handling
0 likes · 23 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

SpringBoot developers often misuse @ControllerAdvice, @RestControllerAdvice, and @Validated, leading to uncaught exceptions, ambiguous responses, and validation errors; this article explains each annotation’s underlying mechanism, proper usage for global exception handling, data binding, request preprocessing, and group‑based validation, and provides production‑ready code examples.
@ControllerAdvice@ValidatedException Handling
0 likes · 20 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

This guide walks through building a complete global exception handling system in SpringBoot using @ControllerAdvice and @ExceptionHandler, covering unified response structures, custom business exceptions, validation error handling, logging best practices, and security considerations to keep controllers clean and maintainable.
@ControllerAdvice@ExceptionHandlerBest Practices
0 likes · 9 min read

This article explains how to design a consistent JSON response format for Spring Boot APIs, covering status‑code conventions, message handling, a reusable Result wrapper class, controller simplification, and a global @ResponseResult annotation with interceptor and advice for automatic response packaging.
@ControllerAdviceAPI DesignJSON
0 likes · 10 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


ITPUBOct 14, 2025 · Backend Development
This article explains how to replace repetitive try‑catch blocks in Spring applications by using @ControllerAdvice, custom Assert utilities, and enum‑based exception definitions, providing a clean, unified error‑handling mechanism with consistent response structures and environment‑aware messaging.
@ControllerAdviceBackendException Handling
0 likes · 25 min read

This article explains why Spring Boot 3.4's new automatic HTTP header binding can corrupt DTO fields like version used for optimistic locking, and provides a global ControllerAdvice solution plus alternative strategies to prevent such conflicts in microservice environments.
@ControllerAdviceHTTP Header BindingSpring Boot
0 likes · 6 min read

This article walks through the design and implementation of symmetric AES encryption for both GET and POST API endpoints in a Spring Boot application, covering requirement analysis, data model definition, custom RequestBodyAdvice and ResponseBodyAdvice, serialization challenges with FastJSON vs Jackson, and final configuration to ensure consistent JSON output across encrypted and non‑encrypted responses.
@ControllerAdviceAESAPI Encryption
0 likes · 12 min read

This article walks through the design and implementation of symmetric request/response encryption for a Spring Boot API, covering requirement analysis, data models, custom ControllerAdvice for decryption and encryption, serialization challenges with FastJson and Jackson, and final configuration to keep encrypted payloads consistent across Android, iOS, and H5 clients.
@ControllerAdviceAPI EncryptionFastjson
0 likes · 12 min read

This article demonstrates how to secure API interfaces by implementing symmetric encryption and decryption for both GET and POST requests in a Spring MVC application, using ControllerAdvice to intercept and process request and response bodies, handling key management, signature verification, and serialization issues across H5, Android, and iOS clients.
@ControllerAdviceAPI SecurityJava
0 likes · 14 min read

The article explains how @ControllerAdvice, a specialization of @Component, enables global exception handling, data binding, and model attribute preprocessing in Spring MVC, demonstrates practical code examples for @ExceptionHandler, @InitBinder, and @ModelAttribute, and dives into the DispatcherServlet internals that make these features work.
@ControllerAdvice@ExceptionHandlerInitBinder
0 likes · 15 min read

Learn how to use Spring's @ControllerAdvice, @ExceptionHandler, @InitBinder, and @ModelAttribute annotations to implement global exception handling, data binding, and pre-processing, including custom exceptions, order control with @Order, and practical code examples for robust backend development.
@ControllerAdviceDataBindingExceptionHandling
0 likes · 12 min read

This article demonstrates how to secure Spring Boot APIs by encrypting request and response bodies using custom ControllerAdvice, switching from FastJson to Jackson for proper enum and date serialization, and configuring ObjectMapper to produce consistent JSON output across encrypted and non‑encrypted endpoints.
@ControllerAdviceAPI SecurityJackson
0 likes · 13 min read

This guide explains how to use @InitBinder and @ControllerAdvice in Spring Boot 2.7.16 to customize WebDataBinder for request parameter conversion, demonstrates practical examples in controllers and global configuration, and shows how to register converters for flexible data binding.
@ControllerAdviceInitBinderSpring Boot
0 likes · 6 min read

This article walks through a real‑world scenario of adding symmetric encryption to Spring MVC endpoints for Android, iOS and H5 clients, detailing the requirements, code implementation of request and response interceptors, serialization pitfalls with enums and LocalDateTime, and the final solution using Jackson's ObjectMapper to keep encrypted and non‑encrypted responses consistent.
@ControllerAdviceAPI SecurityFastjson
0 likes · 17 min read

This article explains how to classify interface exceptions, implement unified handling using Spring Boot's @ControllerAdvice and custom ErrorController, and provides practical code examples for business, system, client, and filter exceptions, including redirect and error page strategies.
@ControllerAdviceErrorControllerException Handling
0 likes · 19 min read

This article explains how to replace repetitive try‑catch blocks in Spring applications with a clean, assertion‑based approach combined with @ControllerAdvice and enum‑driven error codes, providing a unified way to handle service‑layer, controller‑layer, and unknown exceptions while keeping responses consistent and internationalized.
@ControllerAdviceBackendJava
0 likes · 20 min read

This guide explains how to use @ControllerAdvice and @RestControllerAdvice for unified exception handling in Spring, compares their behavior, demonstrates local versus global handling, and shows advanced filtering by annotation, controller class, or package with practical code examples.
@ControllerAdviceBackendExceptionHandling
0 likes · 6 min read

This article explains how to use @ControllerAdvice and @RestControllerAdvice for both local and global exception handling in Spring, demonstrates limiting handlers by annotation, controller class, or package, and clarifies the precedence rules between local and global handlers.
@ControllerAdviceBackendException Handling
0 likes · 7 min read

This article explains how to use @ExceptionHandler with @Controller, @ControllerAdvice, and @RestControllerAdvice for local and global exception handling in Spring MVC, details supported method parameters and return types, and shows how to customize REST API error responses by extending ResponseEntityExceptionHandler.
@ControllerAdviceException HandlingJava
0 likes · 10 min read

This article walks through a complete Spring Boot solution for encrypting and decrypting API requests and responses, covering requirement analysis, data models, custom ControllerAdvice implementations, serialization challenges, and practical code examples using AES and Jackson.
@ControllerAdviceAESAPI Security
0 likes · 14 min read

This article walks through implementing symmetric encryption for both request and response bodies in a Spring MVC project, covering requirement analysis, data model design, custom ControllerAdvice for decryption and encryption, serialization challenges with FastJson and Jackson, and final configuration to ensure consistent API output across Android, iOS, and H5 clients.
@ControllerAdviceFastjsonJackson
0 likes · 14 min read

This article explains how to secure Spring Boot APIs by encrypting request and response bodies with symmetric AES, handling signatures, and configuring Jackson serialization to preserve enum and date formats, providing complete code examples and debugging insights.
@ControllerAdviceJacksonSpring Boot
0 likes · 15 min read

This article explains how to replace repetitive try‑catch blocks in Spring applications with a unified exception handling mechanism based on @ControllerAdvice, custom assertion utilities, and enum‑driven business exceptions, while also showing how to standardize response structures and integrate internationalization.
@ControllerAdviceEnumExceptionHandling
0 likes · 11 min read

This article explains how to centralize exception handling in Spring applications using @ControllerAdvice, replace repetitive null‑checks with Assert utilities, and combine enums with custom BusinessException classes to create a clean, maintainable backend error‑handling strategy.
@ControllerAdviceEnumExceptionHandling
0 likes · 10 min read

This article presents a step‑by‑step guide on securing Spring MVC interfaces by encrypting and decrypting both GET and POST requests using symmetric AES, custom ControllerAdvice components, and Jackson configuration to ensure consistent JSON serialization across mobile, H5, and backend services.
@ControllerAdviceAESJava
0 likes · 12 min read

This article demonstrates how to secure GET and POST API endpoints in a Spring MVC application by encrypting request bodies and responses with AES, using custom ControllerAdvice classes, handling serialization issues with FastJSON and Jackson, and configuring ObjectMapper for proper date and enum formatting.
@ControllerAdviceAESJackson
0 likes · 15 min read

This article walks through implementing symmetric request and response encryption for Spring Boot APIs—covering requirements, data models, controller examples, debugging serialization issues, and using ControllerAdvice with Jackson to ensure encrypted payloads remain compatible across Android, iOS, and H5 clients.
@ControllerAdviceAESAPI Encryption
0 likes · 13 min read

This article explains how to replace repetitive try‑catch blocks in Java Spring applications with a clean, centralized exception handling strategy using @ControllerAdvice, custom Assert utilities, and enum‑based error codes, while also showing how to return consistent error responses across services.
@ControllerAdviceExceptionHandlingJava
0 likes · 25 min read

A high‑severity remote code execution flaw affecting multiple Spring Framework versions and Java 9+ environments was disclosed in March 2022, prompting urgent patches, detailed mitigation steps, and code examples for developers to protect their applications.
@ControllerAdviceJavaRCE
0 likes · 9 min read

This article explains how to replace repetitive try‑catch blocks in Java Spring applications with a clean, unified exception handling approach that leverages @ControllerAdvice, custom Assert utilities, enum‑based error codes, and standardized response objects to improve code readability and maintainability.
@ControllerAdviceEnumException Handling
0 likes · 20 min read

This article explains how to replace repetitive try‑catch blocks in Spring applications by using @ControllerAdvice for global exception handling, custom Assert utilities, and enum‑based error codes, resulting in cleaner, more maintainable backend code and consistent API responses.
@ControllerAdviceBackendassert
0 likes · 23 min read

This article explains how to use Spring Boot's @ControllerAdvice and @ExceptionHandler annotations to implement clean, global exception handling, covering basic usage, controller‑specific handlers, and ordered advice for multiple handlers, with practical code examples and diagrams.
@ControllerAdviceException HandlingJava
0 likes · 7 min read

This article explains why global exception handling is needed in Spring MVC, outlines its application scenarios, compares AOP with the simpler @ControllerAdvice/@ExceptionHandler approach, and provides detailed code examples for custom response objects, validation handling, and transaction rollback strategies to improve code cleanliness and maintainability.
@ControllerAdviceBackendException Handling
0 likes · 11 min read

This article explains how to configure Spring Boot to handle default and custom exceptions globally, covering logging of error mappings, adding Fastjson and Freemarker dependencies, configuring properties, defining error entity and custom exception classes, creating an error template, implementing a @ControllerAdvice handler, and testing with sample controllers and JSON responses.
@ControllerAdviceException HandlingGlobal Exception
0 likes · 13 min read

This article explains how to set up SpringBoot 1.5.17 with Maven, define custom error interfaces, enums, and exception classes, implement a global @ControllerAdvice handler, and verify the behavior through Postman tests for various CRUD endpoints, demonstrating unified error responses.
@ControllerAdviceError ResponseGlobal Exception Handling
0 likes · 15 min read

This article explains how the @ControllerAdvice annotation is discovered and utilized within Spring MVC, detailing the initialization process, the caching of @ExceptionHandler, @ModelAttribute, and @InitBinder methods, and how these global configurations are applied by RequestMappingHandlerAdapter during request handling.
@ControllerAdviceAnnotationsBackend
0 likes · 12 min read

This article explains how to replace repetitive try‑catch blocks in Java Spring applications with a unified exception handling mechanism that leverages @ControllerAdvice, custom Assert utilities, and an enum‑based error‑code system to produce clean, maintainable backend code.
@ControllerAdviceBackendEnum
0 likes · 22 min read

This article explains how to replace repetitive try‑catch blocks in Java Spring applications with a unified exception handling strategy that leverages @ControllerAdvice, custom Assert utilities, and enum‑driven error codes to produce cleaner, more maintainable backend code.
@ControllerAdviceBackendEnum
0 likes · 23 min read

This article explains how to design and implement robust Java exception handling for business systems using Spring MVC, covering when to create custom exceptions, how to structure service and controller code, and how to centralize error responses with @ControllerAdvice for clean, maintainable backend development.
@ControllerAdviceException HandlingJava
0 likes · 13 min read
