我正在尝试在我的批处理作业中使用 spring-retry 库,并将@EnableRetry
注释添加到我@Configuration
的文档中表明我的应用程序现在失败了,因为它出现了一个正在@Autowired
被代理的 spring-batch 库 bean。
@Configuration
@EnableBatchProcessing
@EnableRetry
@Import({SpringBatchConfiguration.class, School192ClientConfiguration.class })
public class SchoolJobConfiguration { .. }
例外:
原因:org.springframework.beans.factory.BeanNotOfRequiredTypeException:名为“jobRegistry”的bean应该是“org.springframework.batch.core.configuration.JobRegistry”类型,但实际上是“com.sun.proxy.$”类型代理130'
我已将以下内容添加到单独的类中:
@Retryable(value = School192ClientException.class, maxAttempts = 3, backoff = @Backoff(delay = 2000))
@Override
protected void doReadPage() {
我的问题是为什么这个 bean ( jobRegistry
) 被代理了?(我对 AOP 没有太多经验)。
我正在使用spring-boot
版本1.5.3.RELEASE
。