通过ApplicationContext.getBean(Class<T>)方法获取bean时报以下错:
org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.uih.anyi.mois.server.impl.InfusionServiceImpl] is defined: expected single bean but found 0:
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:276)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1113)
经查,是因为spring配置文件(applicationContext.xml)里配置了aop导致。
修复办法:
将<aop:config>改为<aop:config proxy-target-class="true">。
具体原因有待分析。
参考:
http://stackoverflow.com/questions/8028849/spring-aop-batch-retry-exception-expected-single-bean-but-found-0/8032665#8032665
http://stackoverflow.com/questions/841231/fixing-beannotofrequiredtypeexception-on-spring-proxy-cast-on-a-non-singleton-be
http://forum.springsource.org/showthread.php?66083-BeanNotOfRequiredTypeException-using-ServiceLocatorFactoryBean-and-Transactional
引用
To be clear: using 'proxy-target-class="true"' on <tx:annotation-driven/>,
<aop:aspectj-autoproxy/> or <aop:config/> elements will force the use of CGLIB
proxies for all three of them.
分享到:
相关推荐
最近在使用python过重遇到这个问题,NameError: name 'xxx' is not defined,在学习python或者在使用python的过程中这个问题大家肯定都遇到过,在这里我就这个问题总结以下几种情况: 错误NameError: name ‘xxx’ ...
ReferenceError: AMap is not defined AMap未定义
但是在项目经过本地测试没有任何问题,打包上线后却会报错 webpackJsonp is not defined。这是因为公共文件必须在自己引用的js文件之前引用。 可以手动改文件引用,但是推荐以下解决办法: 找到build→webpack.prod...
<link rel="stylesheet" type="text/css" href="style.css"> src="http://ditu.google.com/maps?file=api&v=2& key=ABQIAAAAzr2EBOXUKnm_jVnk0OJI7xSosDVG8KKPE1-m51RBrvYughuyMxQ- i1QfUnH94QxWIa6N4U6...
Error creating bean with name 'org.springframework.web.servlet.handler.SimpleUrlHandlerMapping#0' defined in ServletContext resource [/WEB-INF/springMVC-servlet.xml]: Initialization of bean failed;...
在运行之前版本的dome时遇到一个问题: Type com.lfk.justweengine.BuildConfig.class is defined multiple times 在此记录一下解决方法。 原因:module 的名字相同引发的错误
Uncaught ReferenceError: jQuery is not defined 具体报错后样式如下: 具体解决方竟然是修改JQuery的位置,必须在其他所有js的前面!! 错误的代码: 正确的代码: 只能说是自己没有基础了 正确后的样式 ...
其中一个问题是报but there is no HDFS_NAMENODE_USER defined. Aborting operation. Starting datanodes 直接解决 在Hadoop安装目录下找到sbin文件夹 在里面修改四个文件 1、对于start-dfs.sh和stop-dfs.sh文件,...
今天用execjs调用JS时,发现报错execjs._exceptions.ProgramError: ReferenceError: document is not defined 如图: 错误类型:文档对象未定义,解决方法,定义对象即可,习惯性定义变量嘛 var document ;? ...
这不仅是亚马逊热销图书,还是亚马逊四星半图书。如果你想学习Perl,这是一本很好的入门书籍,不厚但能满足基本应用。若想进阶,它还有配套的两部宝典:Intermediate Perl及Mastering Perl。
1.random库的使用: random库是使用随机数的Python标准库 从概率论角度来说,随机数是随机产生的数据(比如抛硬币),但时计算机是不可能产生随机值,真正的随机数也是在特定条件下产生的确定值,只不过这些条件...
Uncaught ReferenceError: ReconnectingWebSocket is not defined; 说明缺少包资源,需引入reconnecting-websocket.js和reconnecting-websocket.minjs 创建WebSocket对象使用ReconnectingWebSocket 如下: var ws =...
LNK2005:symbol already defined和LNK1169:one or more multiply defined symbols found
linux ls find 时大于2G文件时出现Value too large for defined data type 系统本身支持大于2G文件但查询有问题的解决办法
luckysheet源码包
前端项目-lamejs,Pure JavaScript MP3 Encoder
使用IAR开发ADI的ADUC70XX系列单片机时,编译出现下面错误提示: Fatal Error[e72]: Segment FIQ_STACK must b
会话 Session: A unique invocation of Aeron that identifies a single Publication and all Subscriptions for that Publication.会话ID Session ID: A unique identifier for a Session.频道 Channel: A ...
主要介绍了Python 出现错误TypeError: ‘NoneType’ object is not iterable解决办法的相关资料,需要的朋友可以参考下