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文件没有配,是原始的。大侠,救救我啊! 展开
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文件没有配,是原始的。大侠,救救我啊! 展开
3个回答
展开全部
原因可能如下:
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包;
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
跟据这个配置文件users-servlet.xml初始化失败。userForm这个类里面的没有找与userService匹配的。你在配置文件配了userService这个没。
追问
你看看,这个是我的users-servlet.xml配置文件啊
追答
根据错误感觉你的这个标签使用有问题。 你上网查查吧。
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询