Spring batch 如何将Spring云任务与模块化Spring批处理作业一起使用?

Spring batch 如何将Spring云任务与模块化Spring批处理作业一起使用?,spring-batch,spring-cloud-dataflow,spring-cloud-task,Spring Batch,Spring Cloud Dataflow,Spring Cloud Task,我在springbootweb应用程序中开发了两个springbatch作业。为了便于维护,我使用了@EnableBatchProcessing(modular=true)如下: @Configuration @EnableBatchProcessing(modular = true) public class BatchConfiguration { @Bean @ConditionalOnProperty(value="first.batch.enabled", havin

我在
springboot
web应用程序中开发了两个
springbatch
作业。为了便于维护,我使用了
@EnableBatchProcessing(modular=true)
如下:

@Configuration
@EnableBatchProcessing(modular = true)
public class BatchConfiguration {

    @Bean
    @ConditionalOnProperty(value="first.batch.enabled", havingValue = "true")
    public ApplicationContextFactory firstJobs() {
        return new GenericApplicationContextFactory(FirstModule.class);
    }

    @Bean
    @ConditionalOnProperty(value="second.batch.enabled", havingValue = "true")
    public ApplicationContextFactory secondJobs() {
        return new GenericApplicationContextFactory(SecondModule.class);
    }
    ...
}
我有
@Configuration
类,每个
作业都有一个类,分别定义在模块的基本目录中。一切正常,但现在我想设置
springclouddataflow
UI,对我的
作业进行一些基本监控

问题是,当我尝试将
@EnableTask
注释添加到此类
BatchConfiguration
时,
Spring
没有将作业执行与任务执行关联。只有在我运行测试(
@SpringBatchTest
)时,它才起作用

我还尝试将
@EnableTask
注释添加到
FirstJobConfiguration
类中,并将其添加到
BatchConfiguration
First|JobConfiguration
中,但没有效果。我也查阅了官方文件,但什么也没找到

是否可以将
Spring云任务
与模块化
Spring批处理
一起使用


谢谢。

可以将
Spring批处理
应用程序转换为Spring云任务应用程序,并使用Spring云数据流进行管理

您应该能够在SpringBoot应用程序中使用
EnableTask
,并在配置中使用
EnableBatchProcessing


请参见演示此场景的

感谢您的回复,这是完全正确的,但一旦我将作业定义为模块化作业,它们就会在各自的子应用程序上下文中运行,然后
Spring云任务
无法将
任务
执行与
批处理
执行关联起来