[英]Search application.properties in directory external to jar spring boot
There is an option to disregard the spring boot jar package application.properties file and search the properties values of the application.properties from a directory on the server. 有一个选项可以忽略spring boot jar包的application.properties文件,并从服务器上的目录中搜索application.properties的属性值。
On the server where we run the jar application with spring boot, I need the application to look up the properties values of the application.properties file in another directory on the server, disregarding the existing BOOT-INF\\classes\\application.properties directory in the jar. 在我们使用Spring Boot运行jar应用程序的服务器上,我需要该应用程序在服务器的另一个目录中查找application.properties文件的属性值,而无需考虑现有的BOOT-INF \\ classes \\ application.properties jar中的目录。
I would like to make an option to disregard the application.properties in jar spring boot generation and fetch the values of an application.properties from a directory on the server. 我想选择一个选项来忽略jar spring引导生成中的application.properties,并从服务器上的目录中获取application.properties的值。
This configuration would be for the application to work for each environment (production, approval and development) without the need for the developer to change the profiles in the application before the packaging. 此配置将使应用程序能够在每种环境(生产,批准和开发)下工作,而无需开发人员在打包之前更改应用程序中的配置文件。
Any examples of this setup? 此设置有任何示例吗?
Taken from the Spring documentation , you can pass inthe location of your externalised config using this: 取自Spring文档 ,您可以使用以下命令传入外部化配置的位置:
java -jar myproject.jar --spring.config.location=/path/application.properties
This command will support directories, provided spring.config.name
matches the name of your config file. 只要
spring.config.name
与配置文件的名称匹配,此命令将支持目录。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.