Spring Cloud Config和Spring Cloud Vault的初始化顺序 [英] Spring Cloud Config and Spring Cloud Vault order of initialization

查看:135
本文介绍了Spring Cloud Config和Spring Cloud Vault的初始化顺序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在利用Spring Cloud Config和Spring Cloud Config Vault.我们想知道是否有一种方法可以引导引导程序",即我们希望点击Spring Cloud配置服务器,然后从中拉出属性以在我们的保管库配置中加以利用.我们查看了订单,但它似乎不起作用,我认为这是由于后期处理订单引起的,但我希望我可能会遗漏一些东西.

We are leveraging Spring Cloud Config and Spring Cloud Config Vault. We would like to know if there is a way to "bootstrap the bootstrap", ie we want spring cloud config server to be hit and then pull properties from that to leverage in our vault configuration. We looked at order, but it didn't appear to work, and I assume it is because of the post processing order, but I was hoping I might be missing something.

推荐答案

TL; DR

它不起作用.

TL;DR

It doesn't work.

Spring Cloud对其引导上下文进行的操作是设置一个应用程序上下文,该上下文包含从Spring Bean初始化的一组PropertySource.然后,将引导上下文用作Spring Boot创建的实际上下文的父上下文.属性查找在其自己的上下文中和父上下文中查找属性.

What Spring Cloud does with its bootstrap context, is setting up an application context that contains a set of PropertySources initialized from Spring beans. The bootstrap context is used then as parent context for the actual context created by Spring Boot. A property lookup looks for properties in its own context and within the parent context.

配置属性在启动过程中很早就被初始化,它们使用当前Environment中的属性.在初始化ConfigurationProperties Bean时,Environment尚未包含任何远程PropertySource.

Configuration properties are initialized very early in the startup process and they use properties from the current Environment. At the time ConfigurationProperties beans are initialized, the Environment does not yet contain any remote PropertySources.

我在这里看到的唯一选项(除了创建bootstrap-bootstrap-context外)是在您的main类中使用Spring Cloud Config客户端,并在构建任何Spring上下文之前提供Vault属性.

The only option I see here (except creating a bootstrap-bootstrap-context) is using the Spring Cloud Config client within your main class and contribute Vault properties before any Spring context is built.

这篇关于Spring Cloud Config和Spring Cloud Vault的初始化顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆