首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 操作系统 >

NoSuchBeanDefinitionException: No bean named 'userService' is defined

2013-10-27 
求助:NoSuchBeanDefinitionException: No bean named userService is definedCaused by: org.springfram

求助:NoSuchBeanDefinitionException: No bean named 'userService' is defined

Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'userService' is defined

?

配置SpringJunit4测试时如何配置@ContextConfiguration(locations = { "classpath*:/conf/common/applicationContext.xml" })?????

?

具体问题描述如下:

?

目录

    问题报错配置文件分析原因

?

1、问题报错:

Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'userService' is defined

?

?

2、配置文件

?

文档结构:

?
NoSuchBeanDefinitionException: No bean named 'userService' is defined
?

?

测试代码?MybatisTest1:

?

?

配置文件applicationContext.xml:

?

?

?



把applicationContext.xml,jdbc.properties,log4j.properties 拷贝到src下

修改后的配置
A、测试类:


applicationContext.xml中关于jdbc的配置:


但是在测试类中只能把配置文件都放到classpath中了,不能用<file:>这样的前缀解决了,有没有其它的解决办法呢?


热点排行