I'm using Spring Batch and beanValidationItemProcessor() as defined in the documentation.
@Bean
@StepScope
public BeanValidatingItemProcessor<VendorDTO> beanValidatingItemProcessor() throws Exception {
BeanValidatingItemProcessor<VendorDTO> beanValidatingItemProcessor = new BeanValidatingItemProcessor<>();
beanValidatingItemProcessor.setFilter(false);
return beanValidatingItemProcessor;
}
When a validation occurs a org.springframework.batch.item.validator.ValidationException is thrown and I'm able to see my field error like so.
Field error in object 'item' on field 'peid': rejected value []; codes [Size.item.peid,Size.peid,Size.java.lang.String,Size]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [item.peid,peid]; arguments []; default message [peid],12,1]; default message [size must be between 1 and 12]
How do I get a simple message object resolving the field id and default message?
id? what do you mean by "resolving..."? does this go into the right direction: baeldung.com/spring-custom-validation-message-source ? - xerx593