【问题标题】:How to configure custom property file with encrypted properties using spring cloud?如何使用 Spring Cloud 配置具有加密属性的自定义属性文件?
【发布时间】:2018-06-12 08:10:39
【问题描述】:

spring cloud 加密/解密仅适用于 application.properties 文件,但我每个环境都有 env_*.properties,如何配置这些属性以进行加密?

【问题讨论】:

    标签: spring encryption properties cloud


    【解决方案1】:

    Spring 云配置服务器属性文件适用于除 application.properties 文件之外的任何文件名。使用遵循此约定的名称命名此类环境属性文件很重要:

    [spring 应用程序名称]-[环境,例如 dev、staging 等]。[extension] 例如: myapp-dev.propertiesmyapp-dev.yml 其中 my-app > 对应于 spring.application.name 属性值。还要确保这些文件应位于 spring.application.name 值命名的文件夹中。

    【讨论】:

    • 有些东西仍然丢失。主类使用 @PropertySource("file:config/myapp/myapp-dev.properties") 并且在 config/application.properties 我有 spring.application.name=myapp 属性。在依赖项中,我有“spring-cloud-starter-config”
    猜你喜欢
    • 2016-07-12
    • 2017-12-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-08-28
    • 2016-06-11
    • 1970-01-01
    • 2015-06-18
    相关资源
    最近更新 更多