2019年2月15日 | Leave a comment 问题: 解决: 创建两个 TransactionManager @Bean(name=”transactionManager”) @Primary public PlatformTransactionManager defaultTransactionManager() { JpaTransactionManager txManager = new JpaTransactionManager(); txManager.setPersistenceUnitName(“default22″); return txManager; } @Bean(name=”crmTx”) public PlatformTransactionManager crmTransactionManager() { JpaTransactionManager txManager = new JpaTransactionManager(); txManager.setPersistenceUnitName(“crm”); return txManager; } 参考: https://docs.spring.io/spring-boot/docs/2.1.2.RELEASE/reference/htmlsingle/#howto-use-two-entity-managers