Authorization Changes

以下部分与如何适应授权支持中的更改相关。

The following sections relate to how to adapt to changes in the authorization support.

Method Security

Compile With -parameters

Spring Framework 6.1 removes LocalVariableTableParameterNameDiscoverer。这会影响 `@PreAuthorize`和其他 method security注释处理参数名称的方式。如果您正在使用具有参数名称的方法安全性注释,例如:

Spring Framework 6.1 removes LocalVariableTableParameterNameDiscoverer. This affects how @PreAuthorize and other method security annotations will process parameter names. If you are using method security annotations with parameter names, for example:

Method security annotation using id parameter name
@PreAuthorize("@authz.checkPermission(#id, authentication)")
public void doSomething(Long id) {
    // ...
}

您必须编译 -parameters,以确保在运行时可以使用参数名称。有关此内容的更多信息,请访问 Upgrading to Spring Framework 6.1 page

You must compile with -parameters to ensure that the parameter names are available at runtime. For more information about this, please visit the Upgrading to Spring Framework 6.1 page.