我使用自定义方法为我的春季安全pre授权批注,我需要传递一长串烫发。我想外部存储该列表,因为它在一些地方使用,但我可以似乎不知道如何参考上述清单。它似乎总是通过为空。SpEL参考实例变量的类
@RestController
@RequestMapping("/example")
public class MyController {
...constructor/other stuff
public List<String> perms_I_want_to_reference = Arrays.asList("super","long","list")
@PreAuthorizze("@securityService.MyCustomMethod(principal, *this where I want to reference perms*)
@RequestMapping(method = RequestMethod.GET)
public ResponseEntity<?>doSomethingTopSecret(){
}
}
我已经尝试#和制作列表的静态和使用T
但到目前为止,没有什么工作。
Whay你需要通过他们?你不能只从securityService.MyCustomMethod访问它们吗? –
所以很多控制器使用该服务,并且不知道谁在呼叫它。这是真的我想我可以重构以某种方式知道或接收谁在呼叫。我得到这个工作,使烫发清单静态和使用T,但想知道如果有人知道如果/如何/当我不能做我想要的 – Barry