1

我创建了带有 s3 后端的 spring 配置服务器,如下所述: https ://cloud.spring.io/spring-cloud-config/reference/html/#_aws_s3_backend

我在 my-config-server s3 存储桶中创建了 4 个文件:

app-default.properties
app-dev.properties
client-app-default.properties
client-app-dev.properties

当我使用 dev 配置文件运行客户端应用程序时,我得到了client-app-dev.properties 属性。

如果没有在client-app-dev.properties中定义,我是否有可能获得client-app-default.propertiesapp-dev.propertiesapp-default.properties 属性

换句话说,是否可以支持以下层次结构:

application.properties # Applicable for all environments.
  application-dev.properties # Environment level commons across all services.
    client-app-dev.properties # Overrides specific to the service for one environment.
    client-app2-dev.properties

例如:

client-app-dev.properties
  my.property1="my-propertyDev1"

client-app-default.properties
  my.property1="my-propertyDefault1"
  my.property2="my-property2Default"

app-default.properties
  my.property3="my-propertyAppDefault3"

当我使用开发配置文件运行客户端应用程序时,我会得到什么:

@Value("${my.property1}")
private String property1; //"my-propertyDev1"

@Value("${my.property2}")
private String property2; //"my-property2Default"

@Value("${my.property3}")
private String property3; //"my-propertyAppDefault3"

它适用于常规的 spring 配置服务器,但我没有成功支持 s3。它直接转到特定的应用程序和特定的配置文件

4

0 回答 0