首页 文章

Library jar可以从Spring Cloud Config Server读取属性吗?

提问于
浏览
1

我有一个共享库,需要来自.properties文件的一些属性 . Spring Boot应用程序将使用此共享库 . 我们已经有一个Spring Cloud Config服务器,它服务于Spring Boot应用程序的属性 .

现在,我们希望从Config Server获取库的属性,而不是将其属性文件与库jar文件一起打包 .

Can I let my Library file pick-up properties from the Spring Cloud Config server ? The Spring Cloud Config server documentation states the following.. seeing it, looks like only a 'Spring Boot' application can talk to the Spring Cloud Config Server to fetch properties from there.

任何指针或建议?

可以与任何语言运行的任何应用程序一起使用要在应用程序中使用这些功能,只需将其构建为依赖于spring-cloud-config-client的Spring Boot应用程序

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

1 回答

  • 2

    不,图书馆无法与Spring Cloud Config Server通信以获取属性文件 . 相反,配置服务器应该具有那些库文件的属性定义使用应用程序的属性文件 .

    Library:x.jar应用程序:y.jar

    Config Server中的属性文件:y.properties / y.yml

    此属性文件将具有x.jar和y.jar中存在的类的属性

相关问题