Announcement Announcement Module
No announcement yet.
Simple AOP Question Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Simple AOP Question


    I am simply trying to do some AOP on a particular object and on a particular method of that object. I can get the before() advice to work for every method on my object, but I just want to get it to work for just one execute() method. I am sure there is a way to do this but I cannot figure this out based on my spring configuration. Here is my configuration

    <bean id="batchProcessMain"
    class="org.springframework.aop.framework.ProxyFact oryBean">
    <property name="target" ref="batchProcessMainTarget"/>
    <property name="interceptorNames">

    <bean id="batchProcessMainTarget"

    <bean id="batchEventTrackerInterceptor"
    class="com.putnam.fams.batch.aop.BatchEventTracker Interceptor">
    <property name="eventTrackerDao" ref="eventTrackerDao"/>

    Here is my Advice class
    public class BatchEventTrackerInterceptor
    implements MethodBeforeAdvice, AfterReturningAdvice, ThrowsAdvice {

    public void before(Method arg0, Object[] arg1, Object arg2) throws Throwable {

    if( "execute".equals( arg0.getName() ) ) {" This is the execute() Method Process" );

    In my BatchEventTrackerInterceptor I can determine the method easy enough, but I would like to configure this outside of my code.

    Can someone please point out what I am doing wrong?

    I determined the problem. I needed to add the following to my spring config to get the execute to work;

    <bean id="batchEventTrackerAdvisor"
    class=" dPointcutAdvisor">
    <property name="advice">
    <ref local="batchEventTrackerInterceptor"/>
    <property name="pattern">
    Last edited by pdelaney; Nov 15th, 2007, 11:25 AM. Reason: Determined the solution

  • #2
    Use a RegExpMethodAdvisor around your advice OR use the aop config to define an AspectJ pointcut which matches your needs.


    • #3
      AOP problme

      Thanks found the problem thanks for the help!!