Spring Boot: run WAR/JAR with specific profiles and/or port

Running from .war/.jar:
java -Dspring.profiles.active=dev,other -Dserver.port=3000 -jar spring-app.war
or
java -Dspring-boot.run.profiles=dev,other -Dserver.port=3000 -jar spring-app.war
Running from Maven project (Spring Boot 2.x):
mvn spring-boot:run -Dspring-boot.run.profiles=dev,other -Dspring-boot.run.arguments=--server.port=3000

Spring Profiles

Leave a Reply

Your email address will not be published. Required fields are marked *