博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
spring springmvc 注解@service 运行时提示找不到这个service的问题
阅读量:7133 次
发布时间:2019-06-28

本文共 1747 字,大约阅读时间需要 5 分钟。

今天测试spring、springmvc、mybatis,分层为dao、service、serviceimpl、controller,在运行的时候提示

1 org.apache.catalina.core.ApplicationContext.log StandardWrapper.Throwable2  org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'XXXController':      Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException:      No matching bean of type [com.XX.service.IXXService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency.      Dependency annotations: {@javax.annotation.Resource(shareable=true, lookup=, name=, description=, authenticationType=CONTAINER, type=class java.lang.Object, mappedName=)}3     at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:306)4     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1106)5     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)6     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)

 

我所有的注解都已经写好的:

dao   @Repository

serviceimpl     @Service

controller    @Controller

 

并且spring配置文件也写好自动扫描,位置也正确。但错误一直都在

 

 

折腾了一晚上才发现,spring监听配置被注释掉了

在web.xml里面还原spring的监听配置

1  
2
org.springframework.web.context.ContextLoaderListener
3
4
5
org.springframework.web.util.IntrospectorCleanupListener
6

 

然后问题解决了

转载于:https://www.cnblogs.com/rockxt/p/6906578.html

你可能感兴趣的文章
程序员考证之信息系统项目管理师
查看>>
scikit-learn学习笔记
查看>>
mybatis 传入多个参数
查看>>
opencv给图片添加文字水印<转>
查看>>
mysql查询表的数据大小
查看>>
初识Continuation
查看>>
smooth l1
查看>>
ET–异步协程使用–TimerComponent篇
查看>>
Linux LVM学习总结——Insufficient Free Extents for a Logical Volume
查看>>
智课雅思词汇---二十一、名词性后缀acity是什么意思
查看>>
JavaWeb 返回json数据的两种方式
查看>>
(转)Java 详解 JVM 工作原理和流程
查看>>
关于如何获得数据库数据变化的情况(比定时查询方便多了)
查看>>
阿里员工都是这样排查Java问题的,附工具单(转)
查看>>
用flutter写一个精美的登录页面
查看>>
[转]Docker php extensions gd
查看>>
Java Program Mapping GB2312 to Unicode
查看>>
C语言标准中的逻辑位移和算术位移
查看>>
查看当前运行的SQL语句
查看>>
【Python】opencv显示图像
查看>>