Can we handle exceptions in Spring Boot?
1.Yes
2.No
Choose annotation, to handle the exceptions globally
1.@GlobalAdvice
2.@ControllerAdvice
3.Both
4.None
the code to create @ControllerAdvice class to handle the exceptions globally
1.import org.springframework.web.bind.annotation.@GlobalAdvice ; @ControllerAdvice public class ProductExceptionController { }
2.import org.springframework.web.bind.annotation.@@GlobalAdvice ; @GlobalAdice public class ProductExceptionController { }
3.import org.springframework.web.bind.annotation.ControllerAdvice; @ControllerAdvice public class ProductExceptionController { }
4.None
Choose annotation used to handle the specific exceptions and sending the custom responses to the client.
1.@GlobalAdvice
2.@ControllerAdvice
3.@ComponentScan
4.@ExceptionHandler