简体   繁体   English

如何使用 Linux 上的外部 *.ampl 启动可执行 spring 启动 jar 文件?

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

I have spring boot application with executable jar-file我有带有可执行 jar 文件的 spring 引导应用程序

So, I tried to start to from cmd in windows by command因此,我尝试通过命令从 windows 中的 cmd 开始

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 (我尝试使用外部应用程序。yaml 来启动我的应用程序)在我的应用程序中的所有属性。yaml 像这样模拟的数据库

url: ${DATA_BASE_URL} url:${DATA_BASE_URL}

and external yaml contains all values.和外部 yaml 包含所有值。

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.但是,当我尝试在 centOS(或其他 linux)上使用此命令启动应用程序时,尝试启动时失败,spring 引导使用 ${DATA_BASE_URL} 而不是外部应用程序。Z6EEDC03A68A69933C763E674 值。

How to fix it?如何解决?

On linux I used在我使用的 linux 上

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根据官方文档https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-features-external-config-application-property-files

you should use double dashes你应该使用double dashes

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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