使用Starting with Spring Initializr新建了一個spring boot 2.0項目,下載下來以后導入idea,debug方式啟動失敗,報錯如下
網上查找解決辦法,很多都說端口占用導致的,使用CMD 輸入命令 netstat -ano 查看端口7343被哪個進程占用,結果發現這個端口沒有被占用,
結論:端口占用會導致這個錯誤,但是這個錯誤不一定是端口占用導致的
繼續找辦法,csdn一個帖子(https://blog.csdn.net/xu12387/article/details/87777153)提到是maven沒有引入 spring-boot-starter-web也會報這個錯,
修改pom文件,加入如下啟動依賴,重啟服務,錯誤消失
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
在此感謝網友分享:)