java - @EnableGlobalMethodSecurity 在新的 spring boot

我使用 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/

相关文章:

asp.net-mvc - ASP.NET MVC 中的 POST-redirect-GET 有什么

.net - 如何避免 .NET RegEx 类中的无限循环?

c++ - 为什么即使还有弱指针,make_shared 也会调用析构函数?

nlp - 自然语言中的范围歧义

.net - 投票 : What do you call your business layer b

sql - 从 SQL 中的逗号分隔值获取第一个或第二个值

performance - Oracle/PLSQL 性能

user-interface - 愚蠢且令人沮丧的跨浏览器 UI 问题

latex - LaTeX 环境中的多个命令

.net - Winform 样式问题 : Windows classics style?