[英]How to define multiple properties as arguments when JAR run?
Now I run JAR with this argument:现在我用这个参数运行 JAR:
-Dspring.config.location=/opt/application-properties/application.yml
I want to add another one property file to location.我想将另一个属性文件添加到位置。 How to do it?怎么做?
If you read the documentation , ie section 2.3.如果您阅读文档,即第2.3 节。 Application Property Files of the Spring Boot Reference Documentation , you will find: Spring 引导参考文档的应用程序属性文件,您会发现:
If you do not like
application.properties
as the configuration file name, you can switch to another file name by specifying aspring.config.name
environment property.如果您不喜欢application.properties
作为配置文件名,您可以通过指定spring.config.name
环境属性来切换到另一个文件名。 You can also refer to an explicit location by using thespring.config.location
environment property ( which is a comma-separated list of directory locations or file paths ).您还可以使用spring.config.location
环境属性(它是目录位置或文件路径的逗号分隔列表)来引用显式位置。
So, to explicitly answer the question:所以,要明确回答这个问题:
To add another one property file to location, separate them with commas.要将另一个属性文件添加到位置,请用逗号分隔它们。
Example:例子:
-Dspring.config.location=/path1/application1.yml,/path2/application2.yml
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.