From 30351c6277ba00937b99440e360011394b416dcc Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Thu, 2 Oct 2014 16:20:56 +0200 Subject: [PATCH] Provide native JtaTransactionManager when applicable This commit updates JndiJtaConfiguration to provide the same detection algorithm as . If a native JTA transaction manager exists for the current platform, it is used instead of the regular JtaTransactionManager implementation. Fixes gh-1576 --- .../boot/autoconfigure/jta/JndiJtaConfiguration.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jta/JndiJtaConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jta/JndiJtaConfiguration.java index 1ae8bad3c0..e4bd00f980 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jta/JndiJtaConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jta/JndiJtaConfiguration.java @@ -22,6 +22,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.transaction.PlatformTransactionManager; +import org.springframework.transaction.config.JtaTransactionManagerFactoryBean; import org.springframework.transaction.jta.JtaTransactionManager; /** @@ -40,7 +41,8 @@ class JndiJtaConfiguration { @Bean public JtaTransactionManager transactionManager() { - return new JtaTransactionManager(); + JtaTransactionManagerFactoryBean factoryBean = new JtaTransactionManagerFactoryBean(); + return factoryBean.getObject(); } }