Spring Boot應用程式預設的HTTP port號為8080,若要修改port號,可在應用程式的application.properties(or application.yml)修改server.port如下。
Spring Boot的設定檔預設透過classpath下的application.properties或application.yml檔設定,通常放在src/main/resources/下。
以下為application.properties範例。
application.properites
server.port=8081
以下為application.yml範例。
application.yml
server
port: 8081
如果要指定系統中隨機且未被使用的port(Random Unassigned HTTP Port),則設server.port=0。
application.yml
server
port: 0
參考:
沒有留言:
張貼留言