Spring Batch、Boot、JNDI 并且仍然与 transactionManager bean 名称冲突

Spring Batch, Boot, JNDI and still conflicts with the transactionManager bean name

我已经配置 Spring Batch, Boot (2.1.4) 以通过 JNDI 从 JBoss 检索事务管理器,但我仍然与 transactionManager bean 名称有冲突,是否有可能每个时间总是相同的故事,但出于不同的原因?

现在消息是:

DEBUG [org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter] (ServerService Thread Pool -- 76) Application failed to start due to an exception: org.springframework.beans.factory.support.BeanDefinitionOverrideException: Invalid bean definition with name 'transactionManager' defined in class path resource [org/springframework/batch/core/configuration/annotation/SimpleBatchConfiguration.class]: Cannot register bean definition [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.batch.core.configuration.annotation.SimpleBatchConfiguration; factoryMethodName=transactionManager; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/batch/core/configuration/annotation/SimpleBatchConfiguration.class]] for bean 'transactionManager': There is already [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.transaction.jta.JndiJtaConfiguration; factoryMethodName=transactionManager; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/transaction/jta/JndiJtaConfiguration.class]] bound.

Spring 批处理不适用于通过 JNDI 检索的事务管理器?

谢谢

您需要为您的事务管理器指定一个不同于 transactionManager 的名称,因为 @EnableBatchProcessing 已经公开了一个具有该名称的 bean(这在注解的 Javadoc 中提到)。