I am trying to configure XA / distributed transactions for a spring batch / spring cloud task application configured with spring boot.
I added the following dependency, hoping to rely on the automatic spring boot configuration:
compile("org.springframework.boot:spring-boot-starter-jta-atomikos")
However, the following two classes cause the configuration of two transaction managers:
See the following message:
2016-07-18 21:46:19.952 INFO 18995 --- [ main] osbfsDefaultListableBeanFactory : Overriding bean definition for bean 'transactionManager' with a different definition: replacing [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]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.cloud.task.configuration.SimpleTaskConfiguration; factoryMethodName=transactionManager; initMethodName=null; destroyMethodName=(inferred); defined in org.springframework.cloud.task.configuration.SimpleTaskConfiguration]
and then when a PlatformTransactionManager named transactionManager is configured, my automatic atomikos configuration is not raised:
AtomikosJtaConfiguration did not match - @ConditionalOnClass classes found: org.springframework.transaction.jta.JtaTransactionManager,com.atomikos.icatch.jta.UserTransactionManager (OnClassCondition) - @ConditionalOnMissingBean (types: org.springframework.transaction.PlatformTransactionManager; SearchStrategy: all) found the following [transactionManager] (OnBeanCondition)
Can someone help me prevent this excessive forcing transactionManager beans caused by the two classes above?
source share