java-如何在Spring Batch中从ItemReader访问作业参数?
这是我的job.xml的一部分:
reader="foo-reader" writer="foo-writer"
/>
这是商品阅读器:
import org.springframework.batch.item.ItemReader;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@Component("foo-reader")
public final class MyReader implements ItemReader {
@Override
public MyData read() throws Exception {
//...
}
@Value("#{jobParameters['fileName']}")
public void setFileName(final String name) {
//...
}
}
这是Spring Batch在运行时所说的:
Field or property 'jobParameters' cannot be found on object of
type 'org.springframework.beans.factory.config.BeanExpres