Srping Batch 不能 autowire. No beans of 'JobBuilderFactory' type found

Spring Batch 在 autowire 的时候提示:

Could not autowire. No beans of 'JobBuilderFactory' type found. 

这个错误提示其实是在 IntelliJ 中提示的,尽管有这个错误,你的程序还是可以运行没有问题的。

问题解答

简单来说,这个提示就是 IntelliJ 没有办法通过 Autowire 找到对应的 Bean。

如果你使用的是 Spring Batch 的话,你可以在你的 Batch 配置文件中添加:

@EnableBatchProcessing

注解。

这样的话,你的Class 就不会在 IntelliJ 中有这个错误提示了。