J'essaie d'utiliser HibernateInterceptor comme un conseil et j'essaye de l'autowire.Autowiring HibernateInterceptor comme conseil
Le code est le suivant,
@Aspect
public class InterceptorAdvice{
private HibernateInterceptor hibernateInterceptor;
@Autowired
public void setHibernateInterceptor(@Qualifier("hibernateInterceptor") HibernateInterceptor hibernateInterceptor) {
this.hibernateInterceptor = hibernateInterceptor;
}
@Around("execution(* *..*.dao..*.*(..))")
public Object interceptCall(ProceedingJoinPoint joinPoint) throws Exception {
Object obj = null;
try{
.......
}catch(Exception e){
e.printStackTrace();
}
return obj;
}
}
Ce qui suit est mon mapping XML,
<bean id="hibernateInterceptor" class="org.springframework.orm.hibernate3.HibernateInterceptor" autowire="byName">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<!--To enable AspectJ AOP-->
<aop:aspectj-autoproxy/>
<!--Your advice-->
<bean class="com.web.aop.InterceptorAdvice"/>
<!--Looks for any annotated Spring bean in com.app.dao package-->
<context:component-scan base-package="com.web.dao"/>
<!--Enables @Autowired annotation-->
<context:annotation-config/>
Quand je vérifie le hibernateInterceptop, tout ce que je reçois est NULL: (... Je ne sais pas pourquoi son incapacité à lier automatiquement l'intercepteur de mise en veille prolongée
des idées? Merci pour votre temps.
Cheers, J
Que se passe-t-il lorsque vous définissez manuellement une autre propriété pour 'HibernateInterceptor' dans la configuration Spring? –