簡體   English   中英

spring el:參數麻煩

[英]spring el: trouble with parameters

有一個標注為@Preautorize的Web服務方法

@PreAuthorize("principal.somePrincipalMethod(#request.property1, #request.property2, 'stringA', 'stringB')")
public SomeResponse someWebServiceMethod(SomeRequest request) {
...
}
public class SomeRequest {
    Long property1;
    Long property2;
}

並且有兩個重載的類實現了UserDetails方法

public boolean somePrincipalMethod(Long longParam1, Long longParam2, String... stringParams) {
    return true;
}
public boolean somePrincipalMethod(Long longParam, String... stringParams) {
    return true;
}

當我調用someWebServiceMethod我得到somePrincipalMethod(Long longParam, String... stringParams)而不是somePrincipalMethod(Long longParam1, Long longParam2, String... stringParams)

我做錯了什么?

我找到了解決方法(解決方法)。

@PreAuthorize("principal.somePrincipalMethod(#request.property1, #request.property2, {'stringA', 'stringB'})")
public SomeResponse someWebServiceMethod(SomeRequest request) {
...
}
public boolean somePrincipalMethod(Long longParam1, Long longParam2, String[] stringParams) {
    return true;
}
public boolean somePrincipalMethod(Long longParam, String[] stringParams) {
    return true;
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM