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?
CodePudding user response:
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;