Reputation: 59988
I use Spring Boot 3.0, and when I work on security configuration, I get a warning that the @EnableGlobalMethodSecurity
is deprecated.
@Configuration
@EnableWebSecurity
@AllArgsConstructor
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class SecurityConfig {
With what do I replace can replace @EnableGlobalMethodSecurity
in Spring boot 3.0?
Upvotes: 51
Views: 50903
Reputation: 1
From latest versions onwards we can use @EnableMethodSecurity
Check the documentation.
Instead of using prePostEnabled = true
you can use
@EnableMethodSecurity(securedEnabled = true)
because by default it is false.
Upvotes: -1
Reputation: 59988
You can use now:
@EnableMethodSecurity
Check the documentation
Note that you can avoid using prePostEnabled = true
, because by default is true
.
boolean prePostEnabled() default true;
boolean jsr250Enabled() default false;
boolean proxyTargetClass() default false;
Upvotes: 119