【发布时间】:2021-02-20 15:05:28
【问题描述】:
尝试根据环境使用不同的配置文件。例如
在开发环境中,我有以下文件
application-dev.yml
micronaut:
security:
enabled: true
token:
jwt:
enabled: true
signatures:
jwks:
IdentityServer:
url: 'https://localhost:5001/.well-known/openid-configuration/jwks'
对于另一个环境,我有以下配置
application.yml
micronaut:
application:
name: feteBirdApigateway
server:
port: 8080
cors:
enabled: true
security:
enabled: true
token:
jwt:
enabled: true
signatures:
jwks:
IdentityServer:
url: 'https://falconidentityserver.azurewebsites.net/.well-known/openid-configuration/jwks'
现在,当我在 intellj 中运行应用程序时,应用程序正在使用文件 applicaiton.yml。它应该选择application-dev.yml 和值url: 'https://localhost:5001/.well-known/openid-configuration/jwks',但它是从application.yml 中选择值。但是,它应该只从 dev 文件中选择该值,而所有其他值应该从 application.yml 中选择
根据 micronaut 文档 https://docs.micronaut.io/latest/guide/index.html#environments 我需要设置 micronaut.environments
当我在本地机器上运行应用程序时,它不应该选择application-dev.yml。如何设置环境
【问题讨论】:
标签: java micronaut micronaut-client micronaut-rest