Announcement Announcement Module
Collapse
No announcement yet.
MethodInterceptor called several times Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • MethodInterceptor called several times

    Hi all,
    I've just implemented a MethodInterceptor. Everything works fine but in my logs I see that invoke will be called four times though my method is called only one time.

    My Unittest looks like this:
    ...
    Category cat = new Category();
    dao.save(cat);
    ...

    And in my dao:
    ...
    getHibernateTemplate().save(cat)
    ...

    My AOP configuration looks like this:
    ...
    <bean id="debugInterceptor"
    class="net.xxx.DaoLogInterceptor">
    </bean>

    <bean id="regExpPointcut"
    class="org.springframework.aop.support.JdkRegexpMe thodPointcut">
    <property name="pattern" value="net.xxx.dao.*" />
    </bean>

    <bean id="debugAdvisor"
    class="org.springframework.aop.support.DefaultPoin tcutAdvisor">
    <property name="advice" ref="debugInterceptor" />
    <property name="pointcut" ref="regExpPointcut" />
    </bean>

    <bean id="autoProxyCreator"
    class="org.springframework.aop.framework.autoproxy .DefaultAdvisorAutoProxyCreator"/>
    ...

    And my Interceptor:
    ...
    public Object invoke(MethodInvocation arg0) throws Throwable {
    LOG.debug("huhu");
    return arg0.proceed();
    }
    ...

    Really simple I think. But also in Eclipse's debugger I can see hat invoke has been entered several times so that "huhu" appears four times though it should ony appear once after calling save(). Any Idea where is comes from and how I have to configure the Aspect that my logging looks like I expect?

    TIA
    items

  • #2
    Hi all,
    the solution can be found here:
    http://forum.springframework.org/showthread.php?t=43582

    bye
    items

    Comment

    Working...
    X