外部化应用程序-prod.yml

Externalize application-prod.yml

在 jhipster 中,什么是外部化应用程序的简单且最好的方法-prod.yml?我们 运行 在生产中通过 java -jar app.jar 它。

您可以在 .jar 旁边创建一个配置目录,然后将 .yml 保存在该目录中,例如 config/application-prod.yml

Spring 启动将从那里加载属性。

SpringApplication loads properties from application.properties files in the following locations and adds them to the Spring Environment:

A /config subdirectory of the current directory

The current directory

A classpath /config package

The classpath root

The list is ordered by precedence (properties defined in locations higher in the list override those defined in lower locations).