今天配置spring2.0的一个项目,配置了spring2中的aop事务。切入点随便写了个表达式execute(public * *(..)),写了个测试方法,开始初始化spring配置。报出:
开始从配置中删除一些,运行看结果。删除掉<aop:config>的配置后,运行正确。不解,这个地方跟错误有什么关系。仔细考虑了一些,可能是spring当配置aop切入点是会进行一个类似于注册的操作,扫描配置的切入点,生成相应的代理。而前面配置的数据源spring已经初始化并且singleton,所有出现上面的问题。
为了验证猜测,修改了<aop:config>中切入点的配置,给为只捕获本工程的包路径。终于看见熟悉的绿条。:(
一切ok,将机子从外网切回到内网,又是一堆错误。
网上google了一下,没有什么好的结果,看来又要自己来了。
又仔细比对了spring.schemas中的配置,我晕。竟然发现自己的xsd的子版本跟spring中不一样。原来自己spring配置文件中的头是从别的项目中copy了一个,竟然没发现2个项目的spring版本不一样,里面对于的shemas也不一样。马上修改,又见绿条。
总结今天的错误,都是由于粗心,偷懒造成的,引以为戒。
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也不一样。马上修改,又见绿条。
总结今天的错误,都是由于粗心,偷懒造成的,引以为戒。