简体   繁体   English

在jar spring boot外部目录中搜索application.properties

[英]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.

相关问题 Spring Boot 外部应用程序.properties - Spring boot external application.properties 如何将Spring Boot中的application.properties文件外部化为外部依赖JAR? - How to externalize application.properties files in Spring Boot to e.g. external dependent JAR? 如何在Spring Boot中的application.properties中指定外部属性文件? - How to specify external properties files in application.properties in Spring Boot? Spring Boot应用程序不拉入外部application.properties文件 - Spring boot application not pulling external application.properties file in spring boot jar中的application.properties文件在哪里? - Where are the application.properties files in a spring boot jar? Spring Boot - 从依赖的 jar 加载 application.properties/yml - Spring Boot - Load application.properties/yml from dependent jar 使用 gradle 在 spring boot jar 中排除 application.properties - Exclude application.properties inside spring boot jar using gradle Spring启动jar没有读取/解析application.properties根文件夹 - Spring boot jar not reading/parsing application.properties root folder Spring 引导应用程序。导出到 jar 后找不到属性 - Spring Boot application.properties not found after exporting to jar Spring 引导类路径配置文件覆盖外部 application.properties - Spring boot classpath configuration files overrides external application.properties
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM