问题:

 

 

解决:

创建两个 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

 

发表评论

电子邮件地址不会被公开。