我的示例 Spring Batch 项目的下面的 step2()
方法在一台 PC 上工作正常,但在另一台 PC 上抛出以下错误。
有人可以解释一下我的代码有什么问题吗?
Error: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'step2' defined in class path resource [com/xxxx/yyy/configuration/CustomJobConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.batch.core.Step]: Factory method 'step2' threw exception; nested exception is java.lang.NoClassDefFoundError: org/springframework/classify/Classifier
方法:
@Bean
public Step step2() {
System.out.println("Entering step2()");
return stepBuilderFactory.get("step2")
.<String, String>chunk(Integer.valueOf(chunkSize))
.faultTolerant()
.reader(reader())
.writer(writer())
.build();
}
最佳答案
您缺少spring-retry Classifier 的依赖 jar类
Spring Retry provides an abstraction around retrying failed operations
关于java - 如何解决 "Error creating bean with name ' 步骤 2' defined in class path resource "异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52050558/