将XML标记转换为java配置

时间:2017-03-29 11:11:15

标签: spring annotations spring-batch batch-processing

我想将此spring批处理作业的XML标记转换为基于java的注释,但似乎我无法在java config中找到处理程序属性

XML配置

 <job id="partitionJob" xmlns="http://www.springframework.org/schema/batch">

    <step id="masterStep">
    <partition step="slave" partitioner="rangePartitioner">
        <handler grid-size="10" task-executor="taskExecutor" />
    </partition>
    </step>

  </job>

Java配置

@Bean
public Step masterStep() throws Exception {
    return stepBuilderFactory.get("exportStep")
            .partitioner(slave().getName(), rangePartitioner())
            .step(slave()())
            .gridSize(10)
            .taskExecutor(taskExecutor())
            .build();
}



    @Bean
    public Job partitionJob() throws Exception {

        return jobBuilderFactory.get("partitionJob")
                .incrementer(new RunIdIncrementer())
                .start(masterStep())
                .build();
    }

0 个答案:

没有答案