我想通过EL访问方法参数,就像PreAuthor访问它所应用的方法参数一样。
例:
@PreAuthorize("#contact.name == authentication.name")
public void doSomething(Contact contact);
我想为我的自定义方面做类似的事情
@MyAspect("#contact.name")
public void doSomething(Contact contact);
有没有办法通过Spring AOP做到这一点?
正如您在@PreAuthorize代码中看到的那样,注释中应该只有一个value()
属性。这应该得到一个 EL 表达式。
然后,您可以在此处了解如何解析 EL 表达式。