snippetjavaspringCritical
How to configure port for a Spring Boot application
Viewed 0 times
porthowforspringconfigureapplicationboot
Problem
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.Solution
As said in docs either set
For a random port use:
Similarly add
server.port as system property using command line option to jvm -Dserver.port=8090 or add application.properties in /src/main/resources/ withserver.port=8090For a random port use:
server.port=0Similarly add
application.yml in /src/main/resources/ with:server:
port: 8090Code Snippets
server.port=8090server.port=0server:
port: 8090Context
Stack Overflow Q#21083170, score: 1637
Revisions (0)
No revisions yet.