Spring boot 弹簧靴(1.3.6)和#x2B;Hibernate(5.2.1)找不到[org.Hibernate.SessionFactory]类型的符合依赖关系的bean:

Spring boot 弹簧靴(1.3.6)和#x2B;Hibernate(5.2.1)找不到[org.Hibernate.SessionFactory]类型的符合依赖关系的bean:,spring-boot,hibernate-5.x,Spring Boot,Hibernate 5.x,当从单片应用程序进入微服务时,在使用Spring boot(1.3.6)+Hibernate(5.2.1)创建微服务时,我们遇到了一个异常 org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.hibernate.SessionFactory] found for dependency: expected at least 1 bean which qual

当从单片应用程序进入微服务时,在使用Spring boot(1.3.6)+Hibernate(5.2.1)创建微服务时,我们遇到了一个异常

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: {}.
但是相同的源代码在hibernate(4.3.11)上运行。请在上找到源代码


我需要做什么来解决此错误

SpringBoot1.3.6使用Spring4.2.x,它不支持Hibernate5.2。您还必须将Spring升级到4.3,例如,在pom.xml中添加以下属性:

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

4.3.1.1发布

但有些自动配置可能仍然不起作用,因为Spring Boot中的完全Hibernate支持只会在Spring Boot 1.4中引入,它仍在候选版本中。

我想您需要在主类DtcmwsApplication上添加@EnableJpaRepositories注释,还需要删除hibernate entitymanager的排除项