简体   繁体   中英

Spring Boot Tomcat won't start on specific port

I want to run a Spring Boot application using Maven but when I run

mvn clean install spring-boot:run -Dserver.port=8888

Spring runs on port 8080. How should I run a Maven Spring Boot application on a specific port?

I use Spring Boot version 2.2.6.

-Dserver.port is not passed to the JVM running your app.

You have to use

mvn clean install spring-boot:run -Dspring-boot.run.arguments="--server.port=8888"

Read more about this: https://www.baeldung.com/spring-boot-command-line-arguments

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM