0

I have an Advice, and a custom attribute on it. I want to apply the attribute on another method called from advice class that. But the attribute does not get invoked.

My spring config looks pretty similar to the example from the Spring.net manual:

<object id="AspNetCacheAdvice" type="Spring.Aop.Support.AttributeMatchMethodPointcutAdvisor, Spring.Aop"> 
   <property name="advice"> 
      <object type="Aspect.AspNetCacheAdvice, Aspect"/> 
   </property> 
   <property name="attribute" value="Framework.AspNetCacheAttribute, Framework" /> 
</object>
abatishchev
  • 98,240
  • 88
  • 296
  • 433
chitra
  • 3
  • 3

1 Answers1

1

When calling a method from the same class, the method does not get intercepted by Spring AOP, because the method is not called on the aop proxy, but directly on the target it self. Also make sure you configure a proxy factory.

I've answered some questions before that cover the same ground:

Community
  • 1
  • 1
Marijn
  • 10,367
  • 5
  • 59
  • 80
  • Hi Marjin, Thanks for your reply. My understanding is as follows: The proxy of the class whose method I am calling is not getting created. So I have to figure out a way to ensure that the proxy of the advice class as well as the other class is getting created. right? – chitra Apr 19 '12 at 11:47