Exception in thread “main” org.springframework.beans.factory.BeanCreationException: Error creating bean with name “”userManager”” defined in file [E:\java\Hibernate_spring2\bin\applicationContext-beans.xml]: Cannot resolve reference to bean “”sessionFactory”” while setting bean property “”sessionFactory””; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name “”sessionFactory””: Bean with name “”sessionFactory”” has been injected into other beans [txManager] 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. |
|
10分 |
别接触过这个异常。
但是看了下错误异常并且查了下 大概理解为下面几个可能(我是说可能。) 1 SPRING循环依赖 |
10分 |
看你配置文件怎么配置的??
|
看异常好像是循环依赖的问题,楼主把相关配置文件给出来吧,这样好定位原因。
|
|
楼主是不是路径写错了,配置文件贴出来啊
|
|
10分 |
一看 就是 sessionFactory 写错了。仔细检查下巴。
|
出现这样的情况 往往是配置文件出现了问题,请仔细检查一下你的配置文件 bean 配置出现了问题
|
|
10分 |
你的dao bean没有注入sessionFactory
|
你用的dao是不是用MyEclipes自动集成继承HibernateDaoSupport的,要是这样的话service用到dao,必须依赖注入,否则就会出sessionfactory的错。因为dao跟sessionfactory有依赖关系。希望能帮到你
|
|
<bean id=”userManager” class=”com.dlm.manager.UserManager”>
<property name=”sessionFactory” ref=”sessionFactory”/> <property name=”logManager” ref=”logManager”/> </bean> <bean id=”logManager” class=”com.dlm.manager.LogManager”> <property name=”sessionFactory” ref=”sessionFactory”/> </bean> <!– 配置sessionFactory –> |
|
把logManager的bean中的<property name=”sessionFactory” ref=”sessionFactory”/> 去掉。
可能就没问题 |
|
还是没解决
|