Error creating bean with name ‘sqlSessionFactory‘
程序员文章站
2022-07-14 21:13:29
...
2020年7月31日,错误记录。
在spring整合mybatis时,运行项目报出Error creating bean with name 'sqlSessionFactory'的错误,具体信息如下:
它报的信息翻译一下就是:创建定义在类路径资源【spring-context.xml】中的名字为sqlSessionFactory的bean出错,在设置属性值的时候出错,嵌套异常是java.lang.NoClassDefFoundError:org/springframework/jdbc/datasource/TransactionAwareDataSourceProxy
原因:没有引入spring-jdbc的依赖。
解决:maven项目下,在pom.xml文件中引入spring-jdbc的坐标,如下所示。注意,版本号要与spring-context的版本一致。
<!-- https://mvnrepository.com/artifact/org.springframework/spring-jdbc -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>5.2.8.RELEASE</version>
</dependency>
上一篇: Error creating bean with name dfdatasource
下一篇: BeanCreationException: Error creating bean with name ‘requestMappingHandlerAdapter‘
推荐阅读
-
Error creating bean with name 'entityManagerFactory' defined in class path resource解决方案
-
Error creating bean with name ‘eduChapterController‘: Unsatisfied dependency expressed through field
-
UnsatisfiedDependencyException: Error creating bean with name ‘xxxx‘:
-
springMVC常见错误-解决org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.spring
-
Error creating bean with name
-
Error creating bean with name 'eurekaAutoServiceRegistration'
-
Error creating bean with name报错
-
Error creating bean with name dfdatasource
-
Error creating bean with name ‘sqlSessionFactory‘
-
BeanCreationException: Error creating bean with name ‘requestMappingHandlerAdapter‘