Web server failed to start. Port 8080 was already in use.
![Spring Boot中 Web server failed to start. Port 8080 was already in use. Spring Boot中 Web server failed to start. Port 8080 was already in use.](/default/index/img?u=aHR0cHM6Ly9waWFuc2hlbi5jb20vaW1hZ2VzLzEwMy84OGZhNzhlY2ZkMmMwN2NmMGUyNDIzYmVkNzVlMTRiZi5wbmc=)
这种情况是8080端口被占用了,所以再使用会失败。
七夜同学是在运行Spring Boot程序时出的错误。我发现有两种解决方法:
1、默认是8080端口,可以换一个端口,在resource文件下的application.properties里面进行定义,换成没用被占用的端口,添加server.port=9090
![Spring Boot中 Web server failed to start. Port 8080 was already in use. Spring Boot中 Web server failed to start. Port 8080 was already in use.](/default/index/img?u=aHR0cHM6Ly9waWFuc2hlbi5jb20vaW1hZ2VzLzUwNi9iNTA3NWIzOTJhZGUwMzE1ZGU3NjFjZjgwNjBhMjUzYS5wbmc=)
2、七夜同学出现这种问题是在之前运行了一次,再运行一次就会发生这个问题。后来发现运行之后,程序一直在占用这个端口,只需要把这个程序停止,再运行就没问题了。
![Spring Boot中 Web server failed to start. Port 8080 was already in use. Spring Boot中 Web server failed to start. Port 8080 was already in use.](/default/index/img?u=aHR0cHM6Ly9waWFuc2hlbi5jb20vaW1hZ2VzLzk2OS9iNWM5NzViMWQ4YzEwNGRhZDJkMmY1MDBhZTdhNDg1OS5wbmc=)