未加载特定于环境的 Eureka 属性
Environment Specific Eureka properties is not loading
我使用 spring Cloud 1.5.17 版本创建了一个 Eureka 客户端和服务器项目。这两个项目都运行良好,但问题是基于环境,我希望在客户端项目的 运行 时间加载某些尤里卡属性。为此,我所做的是为 eureka 创建了特定于环境的 属性 文件,如下所示。
我已经在 application.yml 中尝试了以下所有三个属性,但其中 none 似乎没有选择 eureka-client-test.properties属性
spring:
profiles:
active: test
eureka:
instance:
environment: test
eureka:
instance:
environment:
active-profiles:
- test
谁能帮我解决这个问题
完整的源代码已提交,可在以下 bitbucket 存储库中获取
使用不带 .properties
后缀的 属性 文件名覆盖此 属性 eureka.client.props
。
因此,假设您使用 spring.profiles.active
指定 spring 活动环境,然后在相应的 application-env.properties
文件中,您可以将 eureka.client.props
设置为 eureka-client-env
。
我使用 spring Cloud 1.5.17 版本创建了一个 Eureka 客户端和服务器项目。这两个项目都运行良好,但问题是基于环境,我希望在客户端项目的 运行 时间加载某些尤里卡属性。为此,我所做的是为 eureka 创建了特定于环境的 属性 文件,如下所示。
我已经在 application.yml 中尝试了以下所有三个属性,但其中 none 似乎没有选择 eureka-client-test.properties属性
spring:
profiles:
active: test
eureka:
instance:
environment: test
eureka:
instance:
environment:
active-profiles:
- test
谁能帮我解决这个问题
完整的源代码已提交,可在以下 bitbucket 存储库中获取
使用不带 .properties
后缀的 属性 文件名覆盖此 属性 eureka.client.props
。
因此,假设您使用 spring.profiles.active
指定 spring 活动环境,然后在相应的 application-env.properties
文件中,您可以将 eureka.client.props
设置为 eureka-client-env
。