(1) 問題描述
啓動 Spring Boot 項目時,拋出該問題:
雙擊該問題,跳轉到 WebSecurityConfigurerAdapter 類:
(2) 原因分析
因爲這個 WebSecurityConfigurerAdapter 類內部依賴了 spring-boot-starter-web,而我們的項目又沒有引入這個包。
(3) 問題解決
在 pom.xml 中引入spring-boot-starter-web:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>