我正在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-boot-starter-security dependentecy,因此它可能使用较新的版本作为已弃用的 WebSecurityConfigurerAdapter 类。
查看链接了解更多详情: