有没有办法通过扫描包中的所有bean和拦截方法,在spring aop中使用动态切入点进行日志记录?
发布于 2017-08-15 07:43:24
下面是一个方面的示例,它将拦截特定包中所有类的所有公共方法。您可以使用它作为起点。
@Aspect
public class LoggingAspect{
@Around("execution(public com.test.model..*.*(..))")
public void logInvocation(ProceedingJoinPoint joinPoint) throws Throwable {
System.out.println("Doing some logging before");
joinPoint.proceed(); // execute the target method
System.out.println("Doing some logging after");
}
}https://stackoverflow.com/questions/45683698
复制相似问题