我使用 Spring Boot 3.0,当我进行安全配置时,我收到一条警告,提示 @EnableGlobalMethodSecurity
已弃用。
@Configuration
@EnableWebSecurity
@AllArgsConstructor
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class SecurityConfig {
用什么替换可以替换Spring boot 3.0中的@EnableGlobalMethodSecurity
?
最佳答案
您现在可以使用:
@EnableMethodSecurity
检查 documentation
请注意,您可以避免使用 prePostEnabled = true
,因为默认情况下是 true
。
boolean prePostEnabled() default true;
boolean jsr250Enabled() default false;
boolean proxyTargetClass() default false;
关于java - @EnableGlobalMethodSecurity 在新的 spring boot 3.0 中被弃用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74910066/