I have two classes
@Data
@NoArgsConstructor
public class SearchProductOffer {
@Valid
private List<MatchProperty> properties = new ArrayList<>();
}
@Data
@NoArgsConstructor
public class MatchProperty {
private String version;
private String sourceSystem;
@NotNull(message = "Версия должна быть заполнена!")
public String codeName;
}
while i validate A with ValidationUtil.invokeValidator i get
2018-07-06 16:04:09.769 ERROR 10223 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.IllegalStateException: JSR-303 validated property 'properties[1].codeName' does not have a corresponding accessor for Spring data binding - check your DataBinder's configuration (bean property versus direct field access)] with root cause
org.springframework.beans.NotReadablePropertyException: Invalid property 'properties[1]' of bean class [java.lang.String]: Bean property 'properties[1]' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter? at org.springframework.beans.AbstractNestablePropertyAccessor.getPropertyValue(AbstractNestablePropertyAccessor.java:622) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]
when fieldB is null. Both classes have getter/setter. Spring Boot 2.0.3.RELEASE
UPDATE I get exception every time, while i want validate with @NotNull(while field value is null) or @NotEmpty(while my field is "") field in inner class.
properties[1]
somewhere in your path. Please post the JSP you use - StanislavL