Http 状态 500 报错
来源:4-12 引入kaptcha实现验证码
树上的伯爵
2020-08-18
补充信息:
老师你好,我在尝试添加验证码图片的时候出现了报错,错误如下:
例外情况
javax.servlet.ServletException: Servlet[spring-dispatcher]的Servlet.init()引发异常
根本原因:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'shopManagementController': Unsatisfied dependency expressed through field 'shopService';
nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.imooc.o2o.service.ShopService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
根本原因:
org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.imooc.o2o.service.ShopService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
同时,在添加了 kpatch 之后, ShopManagementController.java 中也出现了新的 wrong message:
- Could not autowire. No beans of ‘ShopService’ type found.
- Could not autowire. No beans of ‘ShopCategoryService’ type found.
- Could not autowire. No beans of ‘AreaService’ type found.
我尝试了这个文章和评论中的方法,在视频4-5的时候可行,但是这一次都不行了:https://blog.csdn.net/u012453843/article/details/54906905
路径和文件名都没有问题,ShopManagementController 我也仔细对比了没有问题,目前不知道如何定位我的问题,不太清楚 “NoBeanAvailable" 要如何解决。
麻烦老师分析下,下一步应该从哪里 Debug?谢谢老师
写回答
1回答
-
翔仔
2020-08-19
同学好,主要检查一下你的Controller里面的shopService;是否用了@Autowired标签,以及ShopService接口的实现类ShopServiceImpl有没有加上@Service标签
062020-08-22
相似问题