https://blog.csdn.net/xybz1993/article/details/80627432关于这个无法拦截的解释 这里解释的很清楚 但有没有解决的办法:有
首先自定义注解 设置为type
拦截用
execution(* com.demo..*..*.dao..*.*(..))")
//获取方法上的注解
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
Method method = signature.getMethod();
TargetDataSource annotation = method.getAnnotation(TargetDataSource.class);
//获取类上的注解
TargetDataSource targetDataSource = method.getDeclaringClass().getAnnotation(TargetDataSource.class)
搞定
本文介绍了一种使用自定义注解和面向切面编程(AOP)技术来解决无法拦截特定方法调用的问题。通过在目标方法上应用自定义注解,并结合Spring AOP,可以实现在不修改业务代码的情况下对方法进行拦截和处理。

8291

被折叠的 条评论
为什么被折叠?



