我有簡單的 spring mvc 控制器
@GetMapping("/{s}")
@PreAuthorize("@myMethod(s, Constant.WRITE")
public ResponseEntity<MyDto> getDto(
@PathVariable("s") String s
) {}
所以問題是將路徑變數傳遞給 PreAuthorize 注釋。SPeL 可以在這種情況下幫助我嗎?
uj5u.com熱心網友回復:
您可以使用基于運算式的訪問控制
@GetMapping("/{s}")
@PreAuthorize("@myMethod(#s, Constant.WRITE")
public ResponseEntity<MyDto> getDto(
@PathVariable("s") String s
) {}
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/505303.html
上一篇:ServicePUT方法的單元測驗不起作用SpringBoot應用程式
下一篇:錯誤:無法找到或加載主類com.javacourse.springBootDemo.SpringBootDemoApplication
