Spring异常: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
来源:互联网 发布:linux tomcat 日志查看 编辑:程序博客网 时间:2024/05/20 18:53
这两天自己搭spingmvc,总是报错,找不到自动注册的bean
Could not autowire field: private lf.service.UserService lf.controllers.UserController.userService;
nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException:
No qualifying bean of type [lf.service.UserService] found for dependency:
expected at least 1 bean which qualifies as autowire candidate for this dependency.
Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
建一个单元测试,看看能不能跑起来,如果能跑起来,说明是web配置错误,如果不能说明类写的有问题。
类检查方面:
1.是否在加了@Controller @Repository @Service 注解
2.spring-mvc的配置中 是否自动注册了controller类
3.spring的配置中,是否注册了用到的类
4.如果用了mybatis,看看配置的路径是否正确
mapper的namespace是否正确
如果还跑不起来,就可能是web.xml里面丢了listener
我的目录如下
阅读全文
0 0
- Spring异常: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
- @org.springframework.beans.factory.annotation.Autowired(required=true)
- @org.springframework.beans.factory.annotation.Autowired(required=true)
- Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)
- mapper注入失败问题解决 {@org.springframework.beans.factory.annotation.Autowired(required=true)}
- 报错:Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
- Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
- bug解决_{@org.springframework.beans.factory.annotation.Autowired(required=true)}
- beans.factory.BeanCreationException beans.factory.annotation.Autowired(required=true)
- 异常:org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor
- spring异常org.springframework.beans.factory.NoSuchBeanDefinitionException
- Spring的Annotation使用注意(org.springframework.beans.factory.NoSuchBeanDefinitionException)
- 关于Spring中org.springframework.beans.factory.UnsatisfiedDependencyException异常
- Spring中org.springframework.beans.factory.UnsatisfiedDependencyException异常
- spring异常解决方法:org.springframework.beans.factory.BeanCreationNotAllowedException
- Spring容器初始化异常:org.springframework.beans.factory.BeanDefinitionStoreException
- spring boot-部署时报org.springframework.beans.factory.BeanCreationNotAllowedException异常
- spring启动异常:org.springframework.beans.factory.BeanCreationException
- 关于mysql 删除数据后物理空间未释放(转载)
- 语音识别
- python 中函数传递数值(知乎转载)
- Ubunt下开启ROOT帐户
- Java消息中间件---基础篇
- Spring异常: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
- PHP 调用Java Dubbo服务(Dubbo、Hessian、JsonRPC)
- Linux----阿里云服务器配置多个FTP账号
- JSP页面间传递参数方法介绍
- PHPStorm使用技巧及快捷键
- 使用nsupdate命令时报错:update failed: SERVFAIL
- bcmath.so
- Redis之集群redis-trib.rb环境的搭建-yellowcong
- 使用mybatis-generator-core生成MyBatis Mapper文件