2016-07-25 85 views
1

在從單一應用程序轉移到微服務時,在創建使用微服務春天開機(1.3.6)+ Hibernate的(5.2.1),我們得到了一個異常Spring引導(1.3.6)+ Hibernate(5.2.1)找不到符合條件的[org.hibernate.SessionFactory]類型的限定bean:

org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.hibernate.SessionFactory] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}. 

但相同的源代碼是在休眠(4.3.11)上運行。請找到

https://github.com/pandiaraj2/Spring-boot-1.3.6-Hibernate-5.2

什麼我需要做什麼來解決這個錯誤的源代碼?

回答

2

Spring Boot 1.3.6使用Spring 4.2.x,它不支持Hibernate 5.2。您還必須將Spring升級到4.3,例如通過在你的pom.xml中添加以下屬性:

<properties> 
    <spring.version>4.3.1.RELEASE</spring.version> 
</properties> 

但它仍然可能是,一些在autoconfigurations都沒有工作,因爲在春季全面啓動Hibernate的支持只會在春季啓動1.4,被引入了仍然是候選人。

0

我想你需要在你的主類DtcmwsApplication上添加@EnableJpaRepositories註解,還需要刪除hibernate-entitymanager的排除

相關問題