我想创建一个类,添加自定义方法,以便在spring安全表达式语言中通过注释进行基于方法的授权.
例如,我想创建一个像'customMethodReturningBoolean'这样的自定义方法,以某种方式使用:
@PreAuthorize("customMethodReturningBoolean()")
public void myMethodToSecure() {
// whatever
}
Run Code Online (Sandbox Code Playgroud)
我的问题是这个.如果可能,我应该创建自定义方法的子类,我将如何在spring xml配置文件中配置它,并且有人给我一个以这种方式使用的自定义方法的示例?