我们正在使用RestController,并且每一个方法都会收到一条警告,告诉我们@PreAuthorize批注中的变量无法解析:
@GetMapping
@PreAuthorize("isAdmin()")
public ResponseEntity<ResponseBodyWrapper<List<ListData>>> getList() {
// Logic
}
反正有摆脱警告的地方吗?
答案 0 :(得分:1)
这不是最佳解决方案,但是您可以使用@SuppressWarnings("SpringElInspection")
取消对该方法的检查。如果您找到了一种方法来Intellij
来解决变量而不是抑制警告,那么我很乐意看到它。