库 jar 可以从 Spring 云配置服务器读取属性吗?

Can a Library jar read properties from Spring Cloud Config Server?

我有一个共享库需要 .properties 文件中的一些属性。 Spring 引导应用程序将使用此共享库。我们已经有一个 Spring 云配置服务器,它正在为这个 Spring 引导应用程序提供属性。

现在,我们还希望从配置服务器获取库的属性,而不是将其属性文件与库 jar 文件一起打包。

我可以让我的库文件从 Spring 云配置服务器获取属性吗? Spring Cloud Config 服务器文档说明如下。看到它,看起来只有 'Spring Boot' 应用程序可以与 Spring Cloud Config Server 对话以从那里获取属性。

有任何指示或建议吗?

can be used with any application running in any language

To use these features in an application, just build it as a Spring Boot application that depends on spring-cloud-config-client

参考:http://cloud.spring.io/spring-cloud-config/spring-cloud-config.html#_spring_cloud_config_client

不,库无法与 Spring 云配置服务器对话以获取属性文件。相反,配置服务器应该在使用应用程序的属性文件中定义那些库文件的属性。

图书馆:x.jar 申请:y.jar

属性 配置服务器中的文件:y.properties / y.yml

此 属性 文件将具有 类 的属性,同时出现在 x.jar 和 y.jar