没有符合条件的'org.springframework.batch.core.Step'类型的bean可用。

Error:
2020-04-24 00:52:50,892  INFO bcm.BankruptcyCasePurgeDownloadJobProcessingApplication - No active profile set, falling back to default profiles: default
2020-04-24 00:52:53,038  WARN annotation.AnnotationConfigApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.spri
ngframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'bankruptcyCasePurgeDownloadJob' defined in class path resource [com/cgi/ec/down
load/bcm/BankruptcyCasePurgeDownloadSetupConfiguration.class]: Unsatisfied dependency expressed through method 'bankruptcyCasePurgeDownloadJob' parameter 1; nested exce
ption is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.batch.core.Step' available: expected at least
1 bean which qualifies as autowire candidate. Dependency annotations: {}
2020-04-24 00:52:53,071  INFO logging.ConditionEvaluationReportLoggingListener -

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.

/Java代码 @SpringBootApplication @ComponentScan(basePackages = {“com.cgi.ec.download.bcm”, “com.cgi.ec.interface.util.properties”}) public class BankruptcyCasePurgeDownloadJobProcessingApplication {。

    private static final XLogger LOG = XLoggerFactory.getXLogger(BankruptcyCasePurgeDownloadJobProcessingApplication.class);

    public static void main(String[] args) throws Exception {
        String arguments = Arrays.toString(args);
        LOG.debug("[main] starting with args: {}", arguments);

        ConfigurableApplicationContext ctx = SpringApplication.run(BankruptcyCasePurgeDownloadJobProcessingApplication.class, args);
        JobLauncher jobLauncher = ctx.getBean(JobLauncher.class);
        System.out.println("Spring boot success");
        Job jobInstance = ctx.getBean("bankruptcyCasePurgeDownloadJob", Job.class);

        jobLauncher.run(jobInstance, InterfacesCommonConfiguration.getJobParameters());
    }
}

@Configuration
@EnableBatchProcessing
public class BankruptcyCasePurgeDownloadSetupConfiguration {
    private static final XLogger LOG = XLoggerFactory.getXLogger(BankruptcyCasePurgeDownloadSetupConfiguration.class);

    private static final String JOB_NAME = "bankruptcyCasePurgeDownload";

    /**
     * Main SpringBatch Job that defines the steps to the batch job
     * 
     * @return SpringBatch Job object
     */
    @Bean
    public Job testStepJob(JobBuilderFactory jobBuilderFactory, Step bankruptcyCasePurgeDownloadStep) {
        LOG.entry();
        return LOG.exit(jobBuilderFactory.get(JOB_NAME + "Job")
                .incrementer(new RunIdIncrementer())
                .flow(testStep)
                .end()
                .build());
    }

解决方案:

你正试图注入一个类型为 Step 这里。

@Bean
public Job testStepJob(JobBuilderFactory jobBuilderFactory, Step bankruptcyCasePurgeDownloadStep) {
    ...
 }

但根据错误信息,你的应用程序上下文不包含该类型的Bean。

确保你导入一个包含你的步骤Bean定义的配置类,或者在你的扫描包中定义一个该类型的Bean。

给TA打赏
共{{data.count}}人
人已打赏
未分类

为什么当只传递一个字符串数组时,编译器会因为一个非常量表达式而出错?

2022-9-8 18:58:27

未分类

ReactJs: TypeError: 无法读取未定义的jest酶的属性 "name"。

2022-9-8 18:58:29

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索