本文主要是介绍SpringBatch接口BatchConfigurer详解,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
前言:BatchConfigurer作为策略接口提供了自定义SpringBatch基础设施组件能力。在使用@EnableBatchProcessing注解后,即可获取每个SpringBatch基础设施组件实例。
BatchConfigurer接口
当程序使用了@EnableBatchProcessing注解时,SpringBatch会执行以下流程。首先通过BatchConfigurer接口的实现来创建这些bean,然后通过SimpleBatchConfigurationt将它们添加到Spring ApplicationContext中。
BatchConfigurer接口方法
BatchConfigurer提供了四个方法,每个方法都是为SpringBatch基础设施提供了一个主要组件。
- JobRepository操作SpringBatch元数据库增删改查
- JobLauncher启动SpringBatch作业入口
- PlatformTransactionManager 为SpringBatch提供所有的事务管理
- JobExplorer提供了针对作业存储库中所保存数据的只读视图
public interface BatchConfigurer {JobRepository getJobRepository() thr
这篇关于SpringBatch接口BatchConfigurer详解的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!