在SpringBoot应用程序中设置WebSecurityConfig

问题描述 投票:0回答:1

我正在SpringBoot应用程序中设置WebSecurityConfig。

@Configuration
@EnableWebSecurity
public class  WebSecurityConfig extends WebSecurityConfigurerAdapter {

..
}

但是我有这个错误

Cannot resolve symbol 'WebSecurityConfigurerAdapter'

即使我在 pom.xml 中有这个:

 <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
spring spring-boot spring-mvc thymeleaf spring-thymeleaf
1个回答
0
投票

由于您没有将版本设置为 spring-boot-starter-security dependentecy,因此它可能使用较新的版本作为已弃用的 WebSecurityConfigurerAdapter 类。

查看链接了解更多详情:

© www.soinside.com 2019 - 2024. All rights reserved.