How other program language clients use Spring Cloud Config Server?

橙三吉。 提交于 2019-12-11 03:47:42

问题


There is a mention in the 'Spring-Cloud-Config-Server' documentation that says,

To use these features in an application, just build it as a Spring Boot application

Does this mean that my client app also needs to be a Spring Booot application ? Can't i have a Non-Java application accesing the properties in the Config Server via RESTService calls ? If the data is receieved in JSON format, I could always have a JSON parser in my non-java application to parse and use the data.


回答1:


The standard uri's are /{name}/{profiles} and /{name}/{profiles}/{label}. These return a json format optimized for the spring cloud config client.

{name} is the application name. {profiles} is a comma separated list of profiles. {label} is the branch name when using git or svn.

The following return the data in other formats optimized for those formats:

  • /{name}-{profiles}.properties
  • /{label}/{name}-{profiles}.properties
  • {name}-{profiles}.json
  • /{label}/{name}-{profiles}.json
  • /{name}-{profiles}.yml
  • /{name}-{profiles}.yaml
  • /{label}/{name}-{profiles}.yml
  • /{label}/{name}-{profiles}.yaml



回答2:


Other language clients can use it like a rest resource. The client can construct the url based on application, environment and key and make a request to cloud config server.




回答3:


I will still recommend, to have some java library (spring cloud client) in between. Though you can manually parse JSON response but you will have to make sure, you get key/value from first occurrence. Also, you will have to write own logic to replace values from config-server, if overridden by your own cmd line or properties file.



来源:https://stackoverflow.com/questions/29602935/how-other-program-language-clients-use-spring-cloud-config-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!