简体   繁体   中英

How to start executable spring boot jar file with external *.ampl on Linux?

I have spring boot application with executable jar-file

So, I tried to start to from cmd in windows by command

java -jar -Dspring.config.location="application.yaml" MyService.jar

and it sucessfully started

(I try to use external application.yaml to start my application) In my application all properties.yaml like datebase mocked like this

url: ${DATA_BASE_URL}

and external yaml contains all values.

But, when I try to start application using this command on centOS (or other linux), there is fail when try to start, spring boot used ${DATA_BASE_URL} instead external application.yaml values.

How to fix it?

On linux I used

nohup java -jar -Dspring.config.location="application.yaml" MyService.jar

According to the official documentation https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-features-external-config-application-property-files

you should use double dashes

nohup java -jar --spring.config.location="application.yaml" MyService.jar

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