mybatis与spring整合报错Error creating bean with name 'sqlSessionFactory' defined in class path resource
来源:互联网 发布:编程珠玑 kindle 编辑:程序博客网 时间:2024/06/07 23:04
今天做mybatis与spring整合的时候报了一个错误,如下
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'sqlSessionFactory' defined in class path resource [config/applicationContext.xml]:
Cannot resolve reference to bean 'config/mybatis.xml' while setting bean property 'configLocation';
nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'config/mybatis.xml' is defined
英文不太好,大体理解了一下,好像是说在applicationContext.xml中注册configLocation的地方有错
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource"></property>
<property name="configLocation" ref="config/mybatis.xml"></property>
</bean>
仔细检查了一下代码,发现还真是有错,唉,正确的代码如下
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource"></property>
<property name="configLocation" value="config/mybatis.xml"></property>
</bean>
给我一个支点,我能撬动整个地球,给我一个错误,我能搞挺整个项目
- mybatis与spring整合报错Error creating bean with name 'sqlSessionFactory' defined in class path resource
- Spring 整合Hibernate报错:Error creating bean with name 'dataSource' defined in class path resource
- spring boot启动报错Error creating bean with name 'entityManagerFactory' defined in class path resource [
- Error creating bean with name 'sqlSessionFactory' defined in class path resource [applicationContext
- Error creating bean with name 'sqlSessionFactory' defined in class path resource
- Error creating bean with name 'sqlSessionFactory' defined in class path resource
- Error creating bean with name 'sqlSessionFactory' defined in ServletContext resource
- 【解决】SpringMVC整合Shiro之 Error creating bean with name 'shiroFilter' defined in class path resource...
- Error creating bean with name 'sessionFactory' defined in class path resource [spring/applicationCon
- JPA+spring3+hibernate3部署报错Error creating bean with name 'entityManagerFactory' defined in class path
- Error creating bean with name 'mySessionFactory' defined in class path resource [applicationContext.xml]:
- Error creating bean with name 'sessionFactory' defined in class path resource [applicationC
- Error creating bean with name 'org.apache.cxf.wsdl.WSDLManager' defined in class path resource
- Error creating bean with name 'userLoginDAO' defined in class path resource [applicationContext.xml]
- Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xm
- 一、Error creating bean with name 'hsFactory' defined in class path resource [xxx.xml]:
- 错误Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.
- Bug--Error creating bean with name 'sessionFactory' defined in class path resource [data_context.xml
- 思考我的人生
- already defined in LIBCMTD.lib(new.obj) nafxcwd.lib .
- Eclipse 快键
- Nginx.conf配置文件解析
- No Cortex-M Device found in JTAG chain.的解决
- mybatis与spring整合报错Error creating bean with name 'sqlSessionFactory' defined in class path resource
- 使用SQL语句直接保存图片
- Swift社交应用文本输入优化汇总
- char(1)和varchar(1)的区别
- 论述rfid与物联网关系
- iOS 8 AutoLayout与Size Class
- 遗传算法入门(连载之五)
- 股市很火,实业很难
- Linux 基本命令