未能履行以下规定:
BeanWrapperFieldSetMapper.mapFieldSet
(第184行)位于以下行(第187行):
binder.bind(new MutablePropertyValues(getBeanProperties(copy, fs.getProperties())));
@Override
public Properties getProperties() {
if (names == null) {
throw new IllegalStateException("Cannot create properties without meta data");
}
注意:我没有指定名称,因为我正在尝试Automap。
以下是我的代码:
@Bean
public LineMapper<Partner> lineMapper() {
DefaultLineMapper<Partner> lineMapper = new DefaultLineMapper<Partner>();
DelimitedLineTokenizer lineTokenizer = new DelimitedLineTokenizer();
BeanWrapperFieldSetMapper<Partner> fieldSetMapper = new BeanWrapperFieldSetMapper<Partner>();
fieldSetMapper.setBeanFactory(getApplicationContext());
fieldSetMapper.setTargetType(Partner.class);
lineMapper.setLineTokenizer(lineTokenizer);
lineMapper.setFieldSetMapper(fieldSetMapper);
return lineMapper;
}
精确堆栈跟踪
退出-DESCR。 :org.springframework.batch.item.file.FlatFileParseException: Parsing error at line: 1 in resource=[class path resource [partner-import.csv]], input=[Mustermann,Max,dahiya.naveen@gmail.com,m]
引起:java.lang.IllegalStateException: Cannot create properties without meta data
at org.springframework.batch.item.file.transform.DefaultFieldSet.getProperties(DefaultFieldSet.java:745)