3

我正在将应用程序从 Spring Boot 1.5.14.RELEASE 迁移到 2.0.4.RELEASE。如果重要的话,我正在使用 Java 8 和 Maven 3.5.4。请在此处查看重现该问题的完整项目:

https://github.com/dmitrysenkovich/entity-manager-factory-test-example

我不确定它在使用 spring-boot:run 运行时是否有效,但这没关系。所以,请运行 DaoTest,你会得到:

BeanCurrentlyInCreationException: Error creating bean with name 'sessionFactory': Requested bean is currently in creation: Is there an unresolvable circular reference?

这是由于 entityManagerFactory 正在创建中,而 PersistenceTestConfig 中需要它来创建 sessingFactory bean。似乎是因为 Hibernate 5.2 SessionFactory 扩展了 EntityManagerFactory。但我仍然不确定确切的问题是什么。

非常感谢您的帮助!

4

0 回答 0