oauth2.hasAnyScope之上下文为空问题疑问

问题遇到的现象和发生背景

学习博主这篇文章时(https://blog.csdn.net/qq_43437874/article/details/121552989) ,自身代码出现以下问题

Attempted to call method hasAnyScope(java.lang.String,java.lang.String,java.lang.String) on null context object

用代码块功能插入代码,请勿粘贴截图

org.springframework.expression.spel.SpelEvaluationException: EL1011E: Method call: Attempted to call method hasAnyScope(java.lang.String,java.lang.String,java.lang.String) on null context object
at org.springframework.expression.spel.ast.MethodReference.throwIfNotNullSafe(MethodReference.java:154) ~[spring-expression-5.3.23.jar:5.3.23]
at org.springframework.expression.spel.ast.MethodReference.getValueRef(MethodReference.java:83) ~[spring-expression-5.3.23.jar:5.3.23]
at org.springframework.expression.spel.ast.CompoundExpression.getValueRef(CompoundExpression.java:70) ~[spring-expression-5.3.23.jar:5.3.23]
at org.springframework.expression.spel.ast.CompoundExpression.getValueInternal(CompoundExpression.java:91) ~[spring-expression-5.3.23.jar:5.3.23]

我的解答思路和尝试过的方法

这样设置时可以达到效果,但是用
http.authorizeRequests(). antMatchers("/*").access("#oauth2.hasAnyScope('access')")
这样不行

@PreAuthorize(value = "#oauth2.hasAnyScope('servera','access','serverc')")
    //@PreAuthorize("hasRole('access')" )
    //@PreAuthorize("hasAuthority('SCOPE_access')")
    //https://blog.csdn.net/qq_39748549/article/details/123847030
    //whose Authority  (token 关联用户的的权限) 使用 内存与数据库的 是否是通过token去找对用用户信息  使用jwt应该是解析
    //jwt的信息 从中获取authority来控制权限  这涉及用户信息 存取方式带来获取方法的不同
    public String resource()
    {
        return "访问到了resource 资源 ";
    }