我如何编写通用项目阅读器和项目编写器,以便可以在工作的所有步骤中重复使用相同的阅读器和编写器。请帮忙?
提前致谢。
Spring Batch asItemReader和适配器“开箱即用”,可以帮助使许多功能通用ItemProcessor。ItemWriter本质上,它ItemReaderAdapter允许您调用现有的对象和方法,而无需编写自己的阅读器。  
这是一个配置示例
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:batch="http://www.springframework.org/schema/batch"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch.xsd">
    <batch:job id="sampleJob">
        <batch:step id="sampleJob.step1">
            <batch:tasklet>
                <batch:chunk reader="readerAdapter" writer="..." commit-interval="10"/>
            </batch:tasklet>
        </batch:step>
    </batch:job>
    <bean id="readerAdapter" class="org.springframework.batch.item.adapter.ItemReaderAdapter" scope="step">
        <property name="targetObject" ref="myService"/>
        <property name="targetMethod" value="get"/>
        <property name="arguments" value="#{jobParameters['parameterName']}"/>
    </bean>
    <bean id="myService"/>
</beans>
块中的每个“阶段”都有适配器。查看每个适配器上的 javadoc,如果您的服务返回正确类型的对象以参与块,它们将有助于更好地了解情况。