Error creating bean with name 'org.springframework.web.servlet.mvc.annotation

1.Errorcreatingbeanwithname'org.springframework.web.servlet.mvc.annotation.DefaultAnn... 1.Error creating bean with name 'org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping#0' defined in ServletContext resource [/WEB-INF/users-servlet.xml]: Initialization of bean failed; nested exception is
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userForm' defined in file [D:\Workspaces\MyEclipse 8.5\.metadata\.me_tcat\webapps\users\WEB-INF\classes\controller\userForm.class]: Unsatisfied dependency expressed through constructor argument with index 0 of type [model.userService]: : No matching bean of type [model.userService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [model.userService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}

2.Error creating bean with name 'userForm' defined in file [D:\Workspaces\MyEclipse 8.5\.metadata\.me_tcat\webapps\users\WEB-INF\classes\controller\userForm.class]: Unsatisfied dependency expressed through constructor argument with index 0 of type [model.userService]: : No matching bean of type [model.userService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [model.userService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}

3.No matching bean of type [model.userService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}

4.No matching bean of type [model.userService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
...
来个高手帮我看看我用MYEclipse启动Spring mvc的时候报这些错误,不胜感激!!!我是看网上的Spring mvc例子自己写的程序,急啊。。。
配置文件我传图片了,applicationContext.xml文件没有配,是原始的。大侠,救救我啊!
展开
 我来答
时光time100
2018-04-08 · TA获得超过7051个赞
知道小有建树答主
回答量:30
采纳率:100%
帮助的人:7480
展开全部

原因可能如下:

1、可能是使用了外部属性文件,没有导入外部资源文件报错; 

解决方案:引入外部资源文件,在Spring配置文件中加入:<context:property-placeholder location="classpath:db.properties"/> 

2、Spring配置文件正确,是因为没有导入aspectjweaver.jar包; 

解决方案:导入aspectjweaver.jar包就不报错啦,没有导入aspectjweaver.jar可能会报错:Caused by: java.lang.NoClassDefFoundError:org/aspectj/weaver/reflect/ReflectionWorld$ReflectionWorldException,aspectjweaver.jar是和Spring AOP有关的jar包;

本回答被网友采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
sanerhe
2012-05-23
知道答主
回答量:20
采纳率:0%
帮助的人:6.6万
展开全部
兄弟问题解决了没?
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
在奋斗的学生
2012-03-15 · 超过16用户采纳过TA的回答
知道答主
回答量:119
采纳率:0%
帮助的人:57.8万
展开全部
跟据这个配置文件users-servlet.xml初始化失败。userForm这个类里面的没有找与userService匹配的。你在配置文件配了userService这个没。
追问
你看看,这个是我的users-servlet.xml配置文件啊
追答
根据错误感觉你的这个标签使用有问题。 你上网查查吧。
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 2条折叠回答
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式