如何为Spring Boot应用程序配置端口 [英] How to configure port for a Spring Boot application

查看:126
本文介绍了如何为Spring Boot应用程序配置端口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何配置Spring Boot应用程序侦听的TCP / IP端口,因此它不使用默认端口8080。

How do I configure the TCP/IP port listened on by a Spring Boot application, so it does not use the default port of 8080.

推荐答案

as 在文档中说使用命令行选项将 server.port 设置为系统属性jvm - server.port = 8090 或在 / src / main / resources / 中添加 application.properties with

As said in docs either set server.port as system property using command line option to jvm --server.port=8090 or add application.properties in /src/main/resources/ with

server.port = 8090

对于随机端口使用

server.port=0

这篇关于如何为Spring Boot应用程序配置端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆