I have object that I want to validate using Spring Validator.
public record MyRequest(
List<@Valid Item> items,
// ...
)
and Item:
public record Item(
String foo,
// ...
)
Then I want to indicate that the third item has an invalid foo value.
I tried to use errors.rejectValue method with items[2].foo as fieldValue, but I get
the following error:
Cannot retrieve value for field 'items[2].foo' - neither a getter method nor a raw field found