title: Autowiring HibernateInterceptor as Advice
body: <p>I am trying to use HibernateInterceptor as a Advice and I am trying to autowire it.</p>
  
  <p>The code is as follows,</p>
  
  <pre><code>    @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;
  
      }
  
  }
  </code></pre>
  
  <p>The following is my XML mapping,</p>
  
  <pre><code>&lt;bean id="hibernateInterceptor" class="org.springframework.orm.hibernate3.HibernateInterceptor" autowire="byName"&gt;
          &lt;property name="sessionFactory" ref="sessionFactory"/&gt;
      &lt;/bean&gt;
  &lt;!--To enable AspectJ AOP--&gt;
  &lt;aop:aspectj-autoproxy/&gt;
  &lt;!--Your advice--&gt;
  &lt;bean class="com.web.aop.InterceptorAdvice"/&gt;
  &lt;!--Looks for any annotated Spring bean in com.app.dao package--&gt;
  &lt;context:component-scan base-package="com.web.dao"/&gt;
  &lt;!--Enables @Autowired annotation--&gt;
  &lt;context:annotation-config/&gt;
  </code></pre>
  
  <p>When I check the hibernateInterceptop, all I get is NULL :(...Not sure why its unable to autowire the hibernate interceptor</p>
  
  <p>Any ideas? Thanks for your time.</p>
  
  <p>Cheers,
  J</p>