This article is participating in the Java Theme Month – Java Debug Notes Event, see the event link for details

How do I configure ports for Spring Boot applications

How to configure the TCP/IP port on which the Spring Boot application listens so that it does not use the default port 8080.

Answer:


A lot of knowledge points, really need to write out will master ! ! !   \color{purple} a lot of knowledge points, really need to write out just can master!! {~}

Port =8090 or add application.properties in/ SRC /main/resources/ with

server.port=8090

For random ports

server.port=0

Also add application.yml to/SRC /main/resources/ and

server: port : 8090

The article translated from am2dgbqfb6mk75jcyanzabc67y ac4c6men2g7xr2a – stackoverflow – com. Translate. Goog/questions / 2…

In production, we often need to configure application ports for different environments, which I recommendHow do I use Maven to package all jars into one file?It also answers that the plug-in configured at packaging time allows the packaged JAR to configure a different environment.

Here’s a quick snapshot


Welcome to my column S t a c k O v e r F l o w . I select the best questions and answers and test them frequently in interviews ! ! !   \color{red} Welcome to my column StackOverFlow, I will filter the quality of the interview test!! {~}


There are the latest and elegant ways to do this, and I will write my thoughts on this q&A at the end of the article \color{red} has the latest, elegant implementation, and I will also write my opinion on this question at the end of the article {~}

Thank you for reading this, if this article is well written and if you feel there is something to it

Ask for a thumbs up 👍 ask for attention ❤️ ask for share 👥 for 8 abs I really very useful!!

If there are any mistakes in this blog, please comment, thank you very much! ❤ ️ ❤ ️ ❤ ️ ❤ ️