异常:BeanCreationException

我配置文件里:配置了,

@Service 和@Repository都有,为什么一直报找不到我那个service层下的dao类

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping#0' defined in ServletContext resource [/WEB-INF/config/jeecms-servlet-front.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'demoController': Unsatisfied dependency expressed through field 'commonService': Error creating bean with name 'commonService': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.sygh.dao.ICommonDao] found for dependency [com.sygh.dao.ICommonDao]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'commonService': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.sygh.dao.ICommonDao] found for dependency [com.sygh.dao.ICommonDao]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}

2个回答

什么注入方式 ctroller里面怎么注入的service service里面怎么注入的dao 图片说明 报的就是自动装配出问题了 应该就是哪个没有自动装配 如果不用自动装配注解 就要有私有属性service dao。。。set方法

xiaoxiaobai250
xiaoxiaobai250 set方法需要注意什么
接近 2 年之前 回复
xiaoxiaobai250
xiaoxiaobai250 都用的@Autowired注入
接近 2 年之前 回复
xiaoxiaobai250
xiaoxiaobai250 自动扫描配置了,controller上配置了@Controller,service实现类配置@Service("commonService"),dao层实现类配置了@Repository,
接近 2 年之前 回复

看配置文件,自动扫描到没有

xiaoxiaobai250
xiaoxiaobai250 都配置了,就是注入不进去
接近 2 年之前 回复
xiaoxiaobai250
xiaoxiaobai250 自动扫描配置了,controller上配置了@Controller,service实现类配置@Service("commonService"),dao层实现类配置了@Repository,
接近 2 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!