SpelEvaluationException: EL1004E:(pos 0): Method call: Method hasPermission(java.lang.String) cannot be found on MethodSecurityExpressionRoot type

后端 未结 4 659
隐瞒了意图╮
隐瞒了意图╮ 2020-12-19 18:20

I add to my project a class CustomPermissionEvaluator, configured by a configuration class MethodSecurityConfig, but when I try run my application, after I inform my login c

4条回答
  •  感动是毒
    2020-12-19 19:04

    You don't show the code where you use hasPermission('admin_main').

    Although it is wrong anyway: your CustomPermissionEvaluator doesn't have a method with single argument. Or in terms of Spring Security like this:

    boolean hasPermission(Authentication authentication, Object permission);
    

    Maybe do you want to use hasRole('admin_main') ?..

    The main your problem that you don't provide enough arguments for method implementations.

提交回复
热议问题