2 m0 37319558 m0_37319558 于 2017.01.12 11:28 提问

求大神帮助springMVC的问题,在线等!!!!!!!!!!!

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jinJiController': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jinJiService': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.jinji.mapper.XiMapper] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@javax.annotation.Resource(shareable=true, mappedName=, description=, name=, type=class java.lang.Object, authenticationType=CONTAINER, lookup=)}
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:308)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1210)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:755)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4210)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4709)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:802)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:583)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1080)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1003)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:507)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1322)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:325)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1068)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:822)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1060)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:759)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jinJiService': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.jinji.mapper.XiMapper] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@javax.annotation.Resource(shareable=true, mappedName=, description=, name=, type=class java.lang.Object, authenticationType=CONTAINER, lookup=)}
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:308)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1210)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.autowireResource(CommonAnnotationBeanPostProcessor.java:461)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:435)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:559)
at org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:169)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:305)
... 37 more
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.jinji.mapper.XiMapper] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@javax.annotation.Resource(shareable=true, mappedName=, description=, name=, type=class java.lang.Object, authenticationType=CONTAINER, lookup=)}
at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:1301)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1047)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:942)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.autowireResource(CommonAnnotationBeanPostProcessor.java:457)
at org.springframework.context.annotation.CommonAnnotationBeanPost
Processor.getResource(CommonAnnotationBeanPostProcessor.java:435)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:559)
at org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:169)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:305)
... 50 more

5个回答

it_hfzj
it_hfzj   2017.01.12 11:33

No qualifying bean of type [com.jinji.mapper.XiMapper]

看下XiMapper 这个mapper 有吗, 路径什么的, 是否正确

it_hfzj
it_hfzj 回复m0_37319558: 你在单元测试吗
一年多之前 回复
m0_37319558
m0_37319558 有,但是我没起数据库,这个报错是正常的,这个无法创建bean
一年多之前 回复
qq_33180812
qq_33180812   2017.01.12 11:32

你在service层加上@service注解了吗??

m0_37319558
m0_37319558 回复滑头小鬼: @Service("jinJiService") public class JinJiServiceImpl implements JinJiService { @Resource XiMapper xiMapper; public List<Map> queryZHAOPIN(){ return xiMapper.queryZHAOPIN(); }service层
一年多之前 回复
qq_33180812
qq_33180812 可能是你的applicationContext.xml里边有东西写错了,或者是你的serviceImpl这个实现类没有实现service!!! 你仔细看一下你的applicationContext.xml和web.xml配置和你的service层的实现类
一年多之前 回复
m0_37319558
m0_37319558 回复滑头小鬼: 还不行...
一年多之前 回复
qq_33180812
qq_33180812 <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> 在web.xml中加上这句话 把它加在前边
一年多之前 回复
m0_37319558
m0_37319558 加上了,Controller也加了
一年多之前 回复
m0_37319558
m0_37319558   2017.01.12 11:49

<!-- 开启注解扫描 -->
mvc:annotation-driven/
<!-- 扫描controller和service -->
/context:component-scan
这是spring的配置

 <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    <context-param>  
       <param-name>contextConfigLocation</param-name>  
       <param-value>classpath:applicationContext.xml</param-value>  
    </context-param> 
    <!-- 默认欢迎界面 -->
    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>


springmvc

org.springframework.web.servlet.DispatcherServlet


contextConfigLocation
classpath:applicationContext.xml

1

<servlet-mapping>
    <servlet-name>springmvc</servlet-name>
    <url-pattern>*.do</url-pattern>
</servlet-mapping>

web.xml配置

m0_37319558
m0_37319558   2017.01.12 11:50

<!-- 开启注解扫描 -->
mvc:annotation-driven/
<!-- 扫描controller和service -->
/context:component-scan


m0_37319558
m0_37319558   2017.01.12 11:51
   <!-- 开启注解扫描 -->
    <mvc:annotation-driven/>
    <!-- 扫描controller和service --> 
    <context:component-scan base-package="com.jinji"></context:component-scan> 

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!
其他相关推荐
求大神帮忙,在线等
简单的c++题,求教
求kali-linux大神帮助
下载安装好kali-linux之后打开虚拟机也连不上网,也不知道这个系统需要再去做些什么,很迷。第一次接触这个系统,求高高手解惑。十分感谢。
求大神帮助!!!!
如何继承Textview并把他的属性包装在一个属性中进行统一调用
求大神帮助
求指导写一个课程表
求大神帮助!!!!!!!!!!
现在公司要求设计一个智能ai的实验项目主要是实现简单的智能语音交互平台需要软硬件的设计,就是说都需要哪些硬件,需要开发哪些软件系统?我现在的认为就是:     硬件:需要一个pc机,麦克风,用来获取语音输入(或者直接使用一个移动设备)     软件:          1、交互界面,主要用于智能系统唤醒、关闭等服务          2、语音分析系统,用于对输入的语音预处理,获取语音,降噪,增强音...
求帮助啊 求大神帮助
txt文件部分 数据 key     L    M             C                       S                    sigma C             sigma S end_of_head ===========================================================================
免费文字转语音的网站
在通常的工作生活中,有时,我们需要将一段话,一段文字转换语音,语音文件以音频格式存储传播,如mp3, wma,wav等格式。 为了完成上述功能,你可以下载应用程序来完成,但是这种方式有一定的问题和风险,问题在于你要寻找这样的软件,有些软件看起来,有这样的功能,但实际上根本无法工作;你需要在你的机器安装软件,它会占去你的磁盘空间;风险则是很多免费的软件在你安装它的过程中,会给你安装很多的病毒,
01:A+B问题
原题链接 总时间限制: 1000ms 内存限制: 65536kB 描述 在大部分的在线题库中,都会将A+B问题作为第一题,以帮助新手熟悉平台的使用方法。 A+B问题的题目描述如下:给定两个整数A和B,输出A+B的值。保证A、B及结果均在整型范围内。 现在请你解决这一问题。 输入一行,包含两个整数A,B,中间用单个空格隔开。A和B均在整型范围内。 输
实验报告包含pyk文件
学校学校,交流。求大神帮助改进。简简单单,方方正正,ok
奥特曼打怪兽
自己写的小游戏,但是未图形化。求大神帮助图形化。