使用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>
在此感谢网友分享:)