繁体   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