Spring AOP Method Interceptor vs Method Advice -
i new aop , trying understand difference between method interceptor , methodadvice(i.e. methodbeforeadvice or methodafteradvice). me looks both doing same thing i.e. called on method invocation. when should use methodinterceptor vs methodadvice.
take @ definition of org.aopalliance.interceptinterceptor interface (implemented methodinterceptor):
public interface interceptor extends advice { }
it's easy see methodinterceptor advice. difference between advice being defined in @aspect class , such interceptor interceptor implementations can added , removed spring aop proxies @ runtime (casting them 'advised'), whereas advice you're talking more static construct. still essential spring aop since presence tells spring beans wrap in proxy object during application context startup.
Comments
Post a Comment