take a look at the official spring batch documentation for itemReader
public interface ItemReader<T> {
T read() throws Exception, UnexpectedInputException, ParseException;
}
// so it is as easy as
public class ReturnsListReader implements ItemReader<List<?>> {
public List<?> read() throws Exception {
// ... reader logic
}
}
the processor works the same
public class FooProcessor implements ItemProcessor<List<?>, List<?>> {
@Override
public List<?> process(List<?> item) throws Exception {
// ... logic
}
}
instead of returning a list, the processor can return anything e.g. a String
public class FooProcessor implements ItemProcessor<List<?>, String> {
@Override
public String process(List<?> item) throws Exception {
// ... logic
}
}
JdbcPagingItemReader
, can I tweak it to return aList
of objects? Please see my question – Incurious