I use an around advisor
Code:
public class SomeMethodInteceptor implements MethodInterceptor {
public Object invoke(MethodInvocation methodInvocation) throws Throwable {
Object result = null;
try {
result = methodInvocation.proceed();
} catch (Exception e) {
doSomething(e);
}
return result;
}
}
I used this configuration
Code:
<bean name="SomeMethodInteceptor"
class="SomeMethodInteceptor class">
</bean>
<bean
class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
<property name="beanNames">
<value>beanPrefix*</value>
</property>
<property name="interceptorNames">
<list>
<value>SomeMethodInteceptor</value>
</list>
</property>
</bean>
and that is it
Can you share your thought about this solution?