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
.
W3spoint99Begginer
How to configure port for a Spring Boot application?
Share
Option 1:
s said in docs either set
server.port
as system property using command line option to jvm-Dserver.port=8090
or addapplication.properties
in/src/main/resources/
withFor a random port use:
Similarly add
application.yml
in/src/main/resources/
with:Option 2:
You can configure the port programmatically.
For Spring Boot 2.x.x:
For older versions: