Search code examples
javaspringtransactionsweblogicjta

What is default name of Jta transactionManager that registers with <tx:jtaTransactionManager/> in spring and can I change it?


In spring docks Spring Framework 5.1.3.RELEASE Reference - Data Access Says, "For standard scenarios, including WebLogic Server and WebSphere, consider using the convenient  <tx:jta-transaction-manager/>  configuration element. When configured, this element automatically detects the underlying server and chooses the best transaction manager available for the platform. " When <tx:jtaTransaction/> used, What it's default name? Can I change it's name? If I need to use 2 transactionManagers in my project, I need to know it's name, so that I can point out the correct one.

@Transactional("jta")  
public void method test()  
...  
}  
@Transactional("local")  
public void method test1()  
...  
}  

Thanks.


Solution

  • I suggest a read of the schema that defines the tx namespace. It states explicitly what is possible and what it does.

    From said spring-tx.xsd

    Creates a default JtaTransactionManager bean with name "transactionManager", matching the default bean name expected by the "annotation-driven" tag. Automatically detects WebLogic and WebSphere: creating a WebLogicJtaTransactionManager or WebSphereUowTransactionManager, respectively.

    As expected the name will be transactionManager and there is no way to change that as there are no attributes or further configuration on that element.