У меня есть совет от контроллера:
@ExceptionHandler(ConstraintViolationException.class)
ResponseEntity<String> handleConstraintViolationException(ConstraintViolationException constraintViolationException) {
return new ResponseEntity<>(constraintViolationException.getMessage(), HttpStatus.BAD_REQUEST);
}
У меня есть контроллер:
@PostMapping(value="linkSellerBuyer")
@Validated
public String createSellerBuyer(Seller seller, Buyer buyer) {
// some code
return "some response";
}
каждая модель похожа на:
public class Seller {
@NotEmpty String Email;
// and more and more
}
public class Buyer {
@NotEmpty String Email;
// and more and more
}
ошибка, которую я получаю, Я всегда получаю ошибки продавца и покупателя
Например: продавец: не должен быть пустым, покупатель: не должен быть пустым,
Я хочу, чтобы продавец: не должен быть пустым
? Как я могу создать код для этого?