问题描述
在项目启动的时候抱:
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2023-05-15 19:02:31.980 ERROR 22536 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
APPLICATION FAILED TO START
Description:
Web server failed to start. Port 8080 was already in use.
Action:
Identify and stop the process that's listening on port 8080 or configure this application to listen on another port.
原因分析:
是tomcat启动的时候,端口号被占用
解决方案:
第一种方法更改项目运行的端口号
在application.yml中配置tomcat端口
#配置tomcat端口
server:
port: 8081 //8081为自定义的未使用的端口
第二种方法
打开cmd输入: netstat -ano|findstr 8080 //查看占用8080的进程
然后使用: taskkill /F /PID 23920 //将进程关闭,然后运行Spring Boot项目,就不会报错了