<dependencies>
<dependency>
<groupId>aopalliance</groupId>
<artifactId>aopalliance</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
import org.aopalliance.aop.Advice;
import org.springframework.aop.Pointcut;
import org.springframework.aop.PointcutAdvisor;
public class MyAdvisor implements PointcutAdvisor {
private Pointcut pointcut;
private Advice advice;
public MyAdvisor(Pointcut pointcut, Advice advice) {
this.pointcut = pointcut;
this.advice = advice;
}
@Override
public Pointcut getPointcut() {
return pointcut;
}
@Override
public Advice getAdvice() {
return advice;
}
@Override
public boolean isPerInstance() {
return true;
}
}
<bean id="myAdvisor" class="com.example.MyAdvisor">
<property name="pointcut">
<bean class="org.springframework.aop.support.NameMatchMethodPointcut">
<property name="mappedNames">
<list>
<value>doSomething</value>
</list>
</property>
</bean>
</property>
<property name="advice">
<bean class="com.example.MyAdvice" />
</property>
</bean>