今天配置spring2.0的一个项目,配置了spring2中的aop事务。切入点随便写了个表达式execute(public * *(..)),写了个测试方法,开始初始化spring配置。报出:
org.springframework.beans.factory.BeanCurrentlyInCreationException:
Error creating bean with name 'fisDataSource':
Bean with name 'fisDataSource' has been injected into other beans
[fisSessionFactory] in its raw version as part of a circular reference,
but has eventually been wrapped (for example as part of auto-proxy creation).
This means that said other beans do not use the final version of the bean.
This is often the result of over-eager type matching - consider using
'getBeanNamesOfType' with the 'allowEagerInit' flag turned off, for example.
。郁闷了,看意思是说什么循环引用了,看了代码没有循环引用。网上看了一圈也没有结果。只能一步步试了。
开始从配置中删除一些,运行看结果。删除掉<aop:config>的配置后,运行正确。不解,这个地方跟错误有什么关系。仔细考虑了一些,可能是spring当配置aop切入点是会进行一个类似于注册的操作,扫描配置的切入点,生成相应的代理。而前面配置的数据源spring已经初始化并且singleton,所有出现上面的问题。
为了验证猜测,修改了<aop:config>中切入点的配置,给为只捕获本工程的包路径。终于看见熟悉的绿条。:(
一切ok,将机子从外网切回到内网,又是一堆错误。
org.springframework.beans.factory.BeanDefinitionStoreException:
Line 9 in XML document from class path resource [fisconfig/applicationContext.xml]
is invalid; nested exception is org.xml.sax.SAXParseException: cvc-elt.1: Cannot
find the declaration of element 'beans'.
Caused by: org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'beans'.
。我考,刚才还可以,马上就不行了。竟然找不到beans,应该是找不到spring对应的schema。看了一下,classpath中有spring,打开spring的jar包,META-INF下有spring.schemas,安装osgi,spring应该可以找到的了。
网上google了一下,没有什么好的结果,看来又要自己来了。
又仔细比对了spring.schemas中的配置,我晕。竟然发现自己的xsd的子版本跟spring中不一样。原来自己spring配置文件中的头是从别的项目中copy了一个,竟然没发现2个项目的spring版本不一样,里面对于的shemas也不一样。马上修改,又见绿条。
总结今天的错误,都是由于粗心,偷懒造成的,引以为戒。
分享到:
相关推荐
spring问题总结 spring问题总结 spring问题总结 spring问题总结 spring问题总结
编程不良人的SpringCloud笔记和资料,全套 编程不良人的SpringCloud笔记和资料,全套 编程不良人的SpringCloud笔记和资料,全套
java矿建之spring25个经典的Spring面试问题包含答案。
Spring boot基于Redis Hash数据结构实现附近的人Demo,框架由Spring-boot实现,压缩包含源码以及部署jar包。代码清晰,有注释,考虑性能优化
Spring是个强大JAVA应用框架广泛地应用于JAVA应用为PlainOldJavaObjects(POJOs)提供企业级 服务Spring利用依赖注入机制来简化工作同时提高易测性Springbeans及依赖以及beans类所需服务都在配置 文件中进行了详细介绍...
Spring源码最难问题:当Spring AOP遇上循环依赖.docx
Spring专家力作 理论与实践完美结合 问题描述→解决方案→实现方法 第一部分 核心概念 第1章 控制反转和容器 1.1 使用容器管理组件 1.1.1 问题描述 1.1.2 解决方案 1.1.3 实现方法 ...
Spring Security三份资料,实战Spring Security 3.x.pdf;Spring Security 3.pdf;Spring Security使用手册.pdf
Spring boot 是 Spring 的一套快速配置脚手架,可以基于spring boot 快速开发单个微服务,Spring Cloud是一个基于Spring Boot实现的云应用开发工具;Spring boot专注于快速、方便集成的单个个体,Spring Cloud是关注...
动力节点老杜Spring6,配套笔记PDF文件 源自https://www.yuque.com/dujubin/ltckqu/kipzgd?singleDoc#Kp2MS
Spring 配XML的十二种技巧
将spring2的开发包spring.jar替换为附件中压缩文件的所有jar包,既可以将spring2.0的应用升级到spring3.0.5
Spring专家力作 理论与实践完美结合 问题描述→解决方案→实现方法 第一部分 核心概念 第1章 控制反转和容器 1.1 使用容器管理组件 1.1.1 问题描述 1.1.2 解决方案 1.1.3 实现方法 ...
手把手教你集成spring cloud + shiro微服务框架;用最少的工作量,改造基于shiro安全框架的微服务项目,实现spring cloud + shiro 框架集成。博客地址:...
spring3.1官方所有的jar包 org.springframework.aop-3.1.RELEASE.jar org.springframework.asm-3.1.RELEASE.jar org.springframework.aspects-3.1.RELEASE.jar org.springframework.beans-3.1.RELEASE.jar org....
Classes contained in spring-mock.jar: org.springframework.mock.jndi.ExpectedLookupTemplate.class org.springframework.mock.jndi.SimpleNamingContext.class org.springframework.mock.jndi....
Spring和SpringMVC面试问题总结 1.Spring中AOP的应用场景、Aop原理、好处? 2.Spring中IOC的作用与原理?对象创建的过程。 3.介绍spring框架 4.Spring常见创建对象的注解? 5.Spring中用到的设计模式 6.Spring的优点...
org.springframework.core.JdkVersion 于是找到一个spring-core-3.x.RELEASE.jar,用其中的JdkVersion这个类替换spring-2.5.5.jar对应class,问题解决! 注意:别用spring-core-4.x.RELEASE.jar,JdkVersion....
最近研究了一下spring webservice整合,由于第一次做这个,整合期间遇到了不少问题,在网上查找了好久也没找到完整实现的server和client的demo,有的问题折腾了我好几天,看到spring的官网里面有人提相同的问题,...
Spring Boot整合Spring Batch的一个小例子,在网上发现这方面的资源比较少,特此将其上传供大家学习。