Home > OS >  application.yaml files for starting some Spring Boot applications
application.yaml files for starting some Spring Boot applications

Time:11-24

I want to start my app.jar (Spring Boot) using other properties by providing some yaml files e.g. in folders

/opt/app/app1/application1.yaml
/opt/app/app2/application2.yaml
/opt/app/app3/application3.yaml

Each yaml is for one app configuration.

Is there any way to give the new application.yaml as a parameter after the jar sth. like:

java -jar /opt/app/app.jar /opt/app/app3/application1.yaml
java -jar /opt/app/app.jar /opt/app/app3/application2.yaml
java -jar /opt/app/app.jar /opt/app/app3/application3.yaml

We start our application by using the PropertiesLauncher with -cp

java -Xmx4096M -cp /opt/app/app.jar -Dloader.path=additional-libs/ -Dloader.main=app.SpringBootApplication org.springframework.boot.loader.PropertiesLauncher

CodePudding user response:

official doc explains exactly your case.

java -jar /opt/app/app.jar --spring.config.location=/opt/app/app3/application3.yaml
  • Related