我正在使用 Windows 命令来运行带有 embedded tomcat 的 spring-boot 应用程序。此外,我需要使用 CommandlineRunner 运行许多控制台应用程序。我正面临端口使用问题。
***************************
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.
我可以在每个控制台应用程序中设置端口,但我需要同时运行至少 10 个控制台应用程序。
我有应用程序自动更改端口的配置或解决方案吗?
您可以自动生成端口号以摆脱Port was already in use
。只是放server.port= 0
在属性或 yml 中。它是自动生成服务器端口console
.
应用程序属性
server.port= 0
应用程序.yml
server:
port : 0
console
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)