Spring Access Parameter Annotation Value in Rest Controller Advice

99 Views Asked by At

Is it possible to access parameter annotation value in restcontroller advice.In my case MyApiRequest is not valid for that reason I got 400 error.In restcontrolleradvice I catch this error and Also want some logging with myparameter value.But I cant access myparameter value in handleMethodArgumentNotValid exception

@PostMapping(path = "myapi")
public ResponseEntity<MyApiResponse> helloWorld(@RequestBody @Valid MyApiRequest request,@Myannotation final String myparameter)


public class GlobalExceptionHandler extends ResponseEntityExceptionHandler {

  @Override
  protected ResponseEntity<Object> handleMethodArgumentNotValid(
      MethodArgumentNotValidException ex,
      HttpHeaders headers,
      HttpStatusCode status,
      WebRequest request) {
0

There are 0 best solutions below