我在我的系统中使用多个数据库。我正在使用AtomikosDataSourceBean
在多个数据库之间启用 xa 分布式事务。
在spring-configuration.xml
文件中,我可以为两个单独的实体管理器工厂 1 和实体管理器工厂 2 创建 bean EntityManagerFactory
。但是当我使用 Spring Java@Configuration
时,我得到了错误。
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'entityManagerFactory' is defined
如果我将一个创建为 entityManagerFactory,另一个创建为 entityManagerFactory1,则会收到错误消息
Caused by: java.lang.IllegalArgumentException: Not an managed type: class com.tom.boon.core.model.Person
对于在 entityManagerFactory1 下创建的实体。
有人可以帮我弄清楚如何在 Spring Java @Configuration 中定义两个单独的 entityManagerFactory。