提到Spring Batch中的TaskletStep可以用来调用存储过程。谁能提供一个如何从 TaskletStep 调用存储过程的示例?到目前为止,我已经这样做了,但它抛出了一个异常“ Configuration problem: The element [callStoredProcedure] is unreachable"
<job id="job1">
<step id="step1">
<tasklet ref="myTasklet"/>
</step>
</job>
<bean id="myTasklet" class="MyClass">
<property name="dataSource" ref="dataSource"/>
<property name="sql" value="call stored_procedure()"/>
</bean>
Java 类
class MyClass implements Tasklet{
@Override
public RepeatStatus execute(StepContribution contribution,
ChunkContext chunkContext) throws Exception {
JdbcTemplate myJDBC=new JdbcTemplate(getDataSource());
myJDBC.execute(sql);
return RepeatStatus.FINISHED;
}
}
应该如何以及在哪里配置存储过程?将不胜感激收到任何指点?
代替
就放
没有 () 结束。那应该可以解决您的问题