0
votes

I have spring web application (not spring boot) running in AWS. I am trying to create centralized configuration server. How to refresh the spring-cloud-client after the changing the properties? As per tutorial

Actuator endpoint by sending an empty HTTP POST to the client’s refresh endpoint, http://localhost:8080/refresh, and then confirm it worked by reviewing the http://localhost:8080/message endpoint.

But my aws Ec2 instances are behind the loadbalancer so i can't invoke the client url. I didn't understand the netflix Eureka and Ribbon much but it seems like adding another level of load balancer in the client side. I don't like this approach. Just to change a property i don't want to make the existing project unnecessarily complex. Is there any other way? or Am I misunderstood Eureka/Ribbon usage?

I have looked at the spring-cloud-config-client-without-spring-boot, spring-cloud-config-client-without-auto-configuration none of them have answer. First thread was answered in 2015. Wondering is there any update?

1
Eureka and ribbon have nothing to do with config client. There is an HTTP api to config server, but it is still something that you would have to implement on the non-boot client. - spencergibb
@spencergibb could you please explain about Http Api? or provide reference link? How do client refresh the property changes? - Chandru

1 Answers

1
votes

To get the configuration properties from a config server. You can do a http request. Example:

From the documentation we can see:

/{application}/{profile}[/{label}]
/{application}-{profile}.yml <- example
/{label}/{application}-{profile}.yml
/{application}-{profile}.properties
/{label}/{application}-{profile}.properties

So if you would do a request to http://localhost:8080/applicationName-activeProfile.yml you would receive the properties in .yml format for the application with that name and active profile. Spring boot config clients would automatically provide these values but you will have to provide em manually.

You don't need Eureka/Ribbon for this to work, it's a separate component. More info: http://cloud.spring.io/spring-cloud-static/spring-cloud.html#_spring_cloud_config

Maybe you could even use spring-cloud-config but I'm not sure what extra configuration is needed without spring-boot. https://cloud.spring.io/spring-cloud-config/