mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
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
This commit is contained in:
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…
Reference in New Issue
Block a user