0

I am trying to write Control Advice and I want to keep similiar exception handling accross different services. My question is do I need to handle org.springframework.validation.BindException if I am already handling org.springframework.web.bind.MethodArgumentNotValidException?

I am not sure the difference between these 2 exceptions.

MethodArgumentNotValidException extends BindException.

It would be great if someone helps me to tell the scenario when BindException will be thrown and when MethodArgumentNotValidException will be thrown.

Saurabh Gadariya
  • 191
  • 6
  • 20
  • Not every `BindException` is a `MethodArgumentNotValidException`, so yes. When binding and not validation fails you will get another exception. – M. Deinum Apr 18 '23 at 12:18

0 Answers0