Start the jar package with the specified port and configuration file under Windows and Linux

Windows

1. Designated port

java -jar springboot.jar -Dserver.port=8181

2. Specify the configuration file

java -jar springboot.jar -Dspring.profiles.active=dev

3. Specify the port and configuration file at the same time

java -jar springboot.jar -Dserver.port=8181 -Dspring.profiles.active=dev

Linux

1. Start the background service mode

nohup java -jar springboot.jar --server.port=8181 >outlog.log 2>&1 &

2. Load the server configuration file application-dev.yml

nohup java -Dserver.port=8086  -Dspring.config.additional-location=./application-dev.yml -jar ./springboot.jar> nohup.out 2>&1 &

Guess you like

Origin blog.csdn.net/weixin_45313494/article/details/126018907