In a Spring Boot application, to handle exceptions globally, you can use the _____ annotation on a class.
- @ControllerAdvice
- @ExceptionHandler
- @GlobalExceptionHandler
- @RestController
In a Spring Boot application, to handle exceptions globally, you can use the @ControllerAdvice annotation on a class. This annotation allows you to define global exception handling methods that can be applied across multiple controllers in your application. It's a powerful mechanism for centralizing exception handling logic.
Loading...
Related Quiz
- In a Spring Data JPA repository, which annotation is used to annotate a custom query when the derived query mechanism is not sufficient?
- What is the primary purpose of the @SpringBootApplication annotation in a Spring Boot application?
- What is the primary role of an OAuth2 Authorization Server in a Spring Boot application?
- When defining a bean, the _____ annotation can be used to specify the method to invoke when the application context is closed.
- Which of the following is a common practice for defining custom exception response structures in Spring Boot?