前言:BatchConfigurer作为策略接口提供了自定义SpringBatch基础设施组件能力。在使用@EnableBatchProcessing注解后,即可获取每个SpringBatch基础设施组件实例。
BatchConfigurer接口
当程序使用了@EnableBatchProcessing注解时,SpringBatch会执行以下流程。首先通过BatchConfigurer接口的实现来创建这些bean,然后通过SimpleBatchConfigurationt将它们添加到Spring ApplicationContext中。
BatchConfigurer接口方法
BatchConfigurer提供了四个方法,每个方法都是为SpringBatch基础设施提供了一个主要组件。
- JobRepository操作SpringBatch元数据库增删改查
- JobLauncher启动SpringBatch作业入口
- PlatformTransactionManager 为SpringBatch提供所有的事务管理
- JobExplorer提供了针对作业存储库中所保存数据的只读视图
pub