Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
hibernate拦截器循环依赖的Spring配置_Spring_Hibernate - Fatal编程技术网

hibernate拦截器循环依赖的Spring配置

hibernate拦截器循环依赖的Spring配置,spring,hibernate,Spring,Hibernate,我正试图在基于spring的项目中实现hibernate截取以创建日志表,但我在配置文件上遇到了困难。 一切正常,但拦截器从不触发 Im我的拦截器我有@Autowired我的Dao,因为我需要访问它以在日志表中保存新的输入。所有DAO在参数中都有会话工厂,因此当我尝试添加 <property name="entityInterceptor"> <bean class="com.mypackage.MyLoggingInterceptor"></bean>

我正试图在基于spring的项目中实现hibernate截取以创建日志表,但我在配置文件上遇到了困难。
一切正常,但拦截器从不触发

Im我的拦截器我有
@Autowired
我的Dao,因为我需要访问它以在日志表中保存新的输入。所有DAO在参数中都有会话工厂,因此当我尝试添加

<property name="entityInterceptor">
    <bean class="com.mypackage.MyLoggingInterceptor"></bean>
</property>
如果我不添加
entityInterceptor
属性,我的程序工作正常,但从未调用过interceptor。我应该如何解决这种循环依赖性

java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in URL [URL]: Cannot resolve reference to bean 'MyLoggingInterceptor' while setting bean property 'entityInterceptor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'MyLoggingInterceptor': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.mypackage.UserLogDao com.mypackage.MyLoggingInterceptor.userLogDao; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'UserLogDao' defined in URL [URL]: 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': FactoryBean which is currently in creation returned null from getObject