1

While moving into micro-services from monolithic application, upon creating the micro-services using Spring boot (1.3.6) + Hibernate(5.2.1) we got an exception

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: {}.

But the same source code is running on hibernate(4.3.11). Please find the source code on

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

What do I need to do to resolve this error?

M. Deinum
  • 115,695
  • 22
  • 220
  • 224
pandiaraj
  • 580
  • 1
  • 6
  • 18

2 Answers2

2

Spring Boot 1.3.6 uses Spring 4.2.x, which doesn't support Hibernate 5.2. You also have to upgrade Spring to 4.3, e.g. by adding the following property in your pom.xml:

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

But it still might be, that some of the autoconfigurations are not working, because full Hibernate support in Spring Boot will only be introduced in Spring Boot 1.4, which is still in release candidate.

dunni
  • 43,386
  • 10
  • 104
  • 99
0

i guess you need to add @EnableJpaRepositories annotation on your main class DtcmwsApplication and also need to remove exclusion for hibernate-entitymanager

Somnath Goswami
  • 112
  • 1
  • 12