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

989 views Asked by At

I have a shared Library that needs some properties from a .properties file. This shared Library will be used by a Spring Boot application. We already have a Spring Cloud Config server which is serving the properties to this Spring Boot application.

Now, we want the properties for the Library also to be fetched from the Config Server, rather than packaging it's properties file along with the library jar file.

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.

Any pointers or suggestions ?

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

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

1

There are 1 answers

1
yathirigan On BEST ANSWER

No, a Library cannot talk to the Spring Cloud Config Server to get the properties file. Instead the config server should have those Library file's properties define din the using application's properties file.

Library: x.jar Application: y.jar

Property file in Config Server: y.properties / y.yml

This property file will have the properties for classes present both in x.jar and in y.jar