我知道spring批处理框架何时调用JdbcCursorItemReader的read函数,但在此之前,它首先应该调用doopen函数,spring batch框架在哪里调用doopen函数?
@Bean
public JdbcCursorItemReader<User> reader(){
JdbcCursorItemReader<User> reader = new JdbcCursorItemReader<User>();
reader.setDataSource(dataSource);
reader.setSql("SELECT id,name FROM user");
reader.setRowMapper(new UserRowMapper());
return reader;
}
@Bean
public Step step1() {
return stepBuilderFactory.get("step1").<User, User> chunk(10)
.reader(reader())
.processor(processor())
.writer(writer())
.build();
}