springmvc+mybatis项目报UnsatisfiedDependencyException异常

这两天自己在用idea工具搭建一个springmvc+mybatis+maven框架,当部署启动框架demo时报UnsatisfiedDependencyException异常。

具体异常信息如下:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userController': Unsatisfied dependency expressed through field 'userService': 

看了很多个网也还是不知道这个异常的具体名字叫什么,但是大概知道这个异常属于spring框架自动装配失败(既找不到类),所以只能说明spring的xml配置文件有问题。

按这个思路,我就再认真核查了我的applicationContext.xml配置文件。果然查找mapper.xml文件的路径有误。

错误:

name="mapperLocations" value="classpath*:com/demo/dao/xml/*mapper.xml"/>

正确:
name="mapperLocations" value="classpath*:com/demo/dao/xml/*Mapper.xml"/>

UnsatisfiedDependencyException

UnsatisfiedDependencyException

你可能感兴趣的:(java)