,我有以下實施MethodSecurityExpressionOperations
定製SecurityExpressionOperations如春功能規劃環境地政司註冊方法
public class CustomMethodSecurityExpressionRoot extends SecurityExpressionRoot implements MethodSecurityExpressionOperations {
private Object filterObject;
private Object returnObject;
CustomMethodSecurityExpressionRoot(Authentication authentication) {
super(authentication);
}
public boolean isTeamMember(Job job) {
//very interesting logic
}
@Override
public Object getFilterObject() {
return this.filterObject;
}
@Override
public Object getReturnObject() {
return this.returnObject;
}
@Override
public Object getThis() {
return this;
}
@Override
public void setFilterObject(Object obj) {
this.filterObject = obj;
}
@Override
public void setReturnObject(Object obj) {
this.returnObject = obj;
}
}
正如你可以看到我已經自定義的方法稱爲isTeamMember
。此方法已成功通過以下預授權批註進行評估:@PreAuthorize("isTeamMember(#job)")
但不幸的是,它並未被解析爲Spring SpEL函數。
是否有註冊isTeamMember
爲SPEL功能的春天Bootish AUTOMAGIC方式?