更新时间:2023-01-09 23:29:45
实际上你想改变 server.port
并且你可以按照 http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-features-external-config
Actually you want to change server.port
and you can change it in many different ways as described http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-features-external-config
示例:
命令行
java -Dserver.port=$PORT -jar target/demo-0.0.1-SNAPSHOT.jar
java -Dserver.port=$PORT -jar target/demo-0.0.1-SNAPSHOT.jar
还有更多