我试图拦截我的BaseRepostitary
文件中所有返回的列表。这样我就可以找到列表中必须使用此decrypt
方法解密的名称。以下是我的方面类
@Aspect
@Service
public class DecryptionAspect {
@AfterReturning(value = "execution(java.util.List *(..)) "
+ "&& target(org.springframework.stereotype.Repository)) ", returning = "list")
public void decrypt(List list) throws Exception
{
//Do decryption here for the names inside the list
}
}
Run Code Online (Sandbox Code Playgroud)
但问题是,decrypt
当我的存储库类受到攻击时,该方法不会触发。所以我的表达有问题。我知道我可以通过包名称来定位存储库类。但我有很多存储库类,并且我已经@Repository
为这些类提供了注释。所以我希望这个 AOP 表达式能够识别哪些类具有@Repository
注释,并拦截存储库类中的所有列表项。那么如何重写我的表达式。提前致谢!