我在带有OAuth2的SpringMVC上有一个RESTAPI。为了支持像hasRole和hasAuthority这样的表达式处理程序,我添加了以下配置:@Configuration@EnableGlobalMethodSecurity(prePostEnabled=true)publicclassMethodSecurityConfigextendsGlobalMethodSecurityConfiguration{@OverrideprotectedMethodSecurityExpressionHandlercreateExpressionHandler(){returnnewO