Provide native JtaTransactionManager when applicable

This commit updates JndiJtaConfiguration to provide the same detection
algorithm as <tx:jta-transaction-manager>. If a native JTA transaction
manager exists for the current platform, it is used instead of the regular
JtaTransactionManager implementation.

Fixes gh-1576
pull/1659/head
Stephane Nicoll 10 years ago
parent 64ef03aafd
commit 30351c6277

@ -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();
}
}

Loading…
Cancel
Save