我正在使用Spring Security进行方法权限检查。我想调用一个私有方法来收集一些数据发送到hasPermission()方法。以下是我尝试执行的操作,并且我得到SpelEvaluationException,因为Spring正在寻找MethodSecurityExpressionRoot中的localPrivateMethod。有没有办法做到这一点?谢谢。在Spring中调用私有方法@PreAuthorize
@PreAuthorize("hasPermission(new Object[]{#arg3, #localPrivateMethod(#arg1,#arg2)}, 'canDoThis')")
public long publicMethod1(long arg1, long arg2, long arg3)
{
}
private String localPrivateMethod(long a1, long a2)
{
}
这里的总体思路:http://stackoverflow.com/questions/13564627/spring-aop-not方法调用在另一个方法内 –