service的bean无法注入,什么原因?
来源:2-6 逐层完成SSM的各项配置
幕布斯8047256
2019-07-24
Error creating bean with name ‘areaController’: Unsatisfied dependency expressed through field ‘areaService’;
nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type ‘com.lijiang.o2o.service.AreaService’ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
3回答
-
枳飨詠逺相守0
2020-03-06
解决了吗????我也是这样的问题。AreaService的bean总是失败,AreaDao没问题
java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'shopServiceImpl' defined in file [/Users/apple/IdeaProjects/myo2o/target/classes/com/harry/o2o/service/impl/ShopServiceImpl.class]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileUploadException
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileUploadException
Caused by: java.lang.ClassNotFoundException: org.apache.commons.fileupload.FileUploadException
122020-03-06 -
翔仔
2019-07-25
同学好,首先可以尝试右键tomcat server 然后 clean 看看;如果不行,在还没有解决类似问题的能力之前,还是和视频里一样的配置,spring-service.xml里
<context:component-scan base-package="com.imooc.o2o.service" />
到service而不是到impl
其次,
serviceimpl里直接
@Service public class AreaServiceImpl implements AreaService {
即可
022019-07-25 -
Sivel
2019-07-24
截图发出来
062019-07-25
相似问题