春季批量jobexplorer问题

时间:2015-10-12 07:51:55

标签: spring-batch

我们正在尝试运行一个因以下问题而失败的弹簧批。

我的配置:

1)Spring boot

@ComponentScan(basePackages = { "some pkgs” })
@ImportResource("classpath:dataSource.xml")
@EnableAutoConfiguration(exclude = DataSourceTransactionManager.class)
public class CollateralReportGeneratorBootstrapper {
public static void main(String[] args) {
     System.exit(SpringApplication.exit(SpringApplication.run(CollateralReportGeneratorBootstrapper.class, args)));
}

}

2)批次

@Configuration
@EnableBatchProcessing
@ComponentScan(basePackages = { "some pkgs”})
public class ReportGenerator {

@Autowired
private JobBuilderFactory jobBuilderFactory;

@Autowired
private StepBuilderFactory stepBuilderFactory;

3)依赖关系:spring-batch-core,spring-batch-infrastructure,spring-boot-starter-batch

如果有人遇到此问题或对可能的解决方案有任何想法,请告诉我!!

Exception in thread "main" org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'jobLauncherCommandLineRunner' defined in class path resource [org/springframework/boot/autoconfigure/batch/BatchAutoConfiguration.class]: Unsatisfied dependency expressed through constructor argument with index 1 of type [org.springframework.batch.core.explore.JobExplorer]: : No qualifying bean of type [org.springframework.batch.core.explore.JobExplorer] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.batch.core.explore.JobExplorer] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:747)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:462)

1 个答案:

答案 0 :(得分:0)

我建议先从下面的示例开始,然后将启动器类添加到它......

http://spring.io/guides/gs/batch-processing/