How would you implement a custom error response structure when an exception occurs in a Spring Boot application?
- By modifying the default Spring Boot error page.
- By overriding the handleException method in a custom exception handler class.
- By configuring a custom ErrorAttributes bean to control the error response structure.
- By using the @ControllerAdvice annotation without customization.
To implement a custom error response structure in Spring Boot when an exception occurs, you can configure a custom ErrorAttributes bean. This bean allows you to control the error response structure. The other options don't provide a direct mechanism for customizing the error response structure.
Loading...
Related Quiz
- Which annotation is used to define a bean in the Spring context?
- In Spring Security, the _____ is responsible for creating a user Authentication object from an HttpServletRequest.
- In a Spring Security enabled project, which method is used to configure HTTP security?
- What is the main purpose of Auto Configuration in Spring Boot?
- What is the primary file used to define properties in Spring Boot?