I have some code like this
@Controller
class SomeController
@GetMapping("/someAsync")
@ResponseBody
public String someAsync() {
throw new SomeException();
}
@GetMapping("/somePage")
public String somePage() {
throw new SomeException();
}
in this case, i want to redirect to default error page for "/somePage"
and I need to response like { HttpStatus:500, message: "something happened" }
I made this ControllerAdvice
@ControllerAdvice
class SomeAdvice
@ExceptionHandler(Exception.class)
@ResponseBody
public Object handle(Exception e) {
// in this method, I want to know this Exception was called by a method that contains "@ResponseBody"
}
Could I know the method signature like this way?