如何用spring boot hibernate解决UnsatisfiedDependencyException?

时间:2017-10-11 03:25:10

标签: spring hibernate spring-boot

当Spring启动休眠连接时,我遇到以下问题。

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'bookController': Unsatisfied dependency expressed through field 'bookService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'bookServiceImp': Unsatisfied dependency expressed through field 'bookDao'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'bookDaoImp': Unsatisfied dependency expressed through field 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getSessionFactory' defined in class path resource [com/go/myapp/Config/AppConfig.class]: Invocation of init method failed; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]

1 个答案:

答案 0 :(得分:0)

如果您使用maven构建项目,请查找pom文件。当您添加依赖项时,这些依赖项会有Compile Dependencies。对于示例SpringBoot Starter 1.5.8。发布https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter/1.5.8.RELEASE

SpringBoot 1.5.8。发布 SpringCore 4.3.12。发布

因此请检查您的依赖项并编译依赖项。 发布您的POM文件将有所帮助