使用spring AOP方面拦截方法?
我正在使用spring AOP来拦截这些方法。 我的spring配置文件中有以下配置。
Aspect类:
@Aspect public class MyAspect{ @Around("execution(public * *(..))") public Object doAction(ProceedingJoinPoint call) throws Throwable { //somelogic }
以上方法不拦截私有方法? 我该怎么做才能要求方面拦截私人和公共方法?
私有方法可能不会被截获,因为它们可能无法通过代理调用。
但是,您可以使用本机AspectJ编织,如以下页面的第8.8.4点所示: