I have followed this official tutorial Getting Started Centralized Configuration using spring boot 2.0.0.RELEASE and spring cloud Finchley.M8
But refreshing properties on the fly (Without restart) is not working. After Some debugging, I noticed that in method refresh() from ContextRefresher.class, it returns the changed keys correctly, but after reconstructing the bean annotated with @RefreshScope in the next use. It still sees the old value not the updated one.
Note: This was working perfectly with spring boot v 1.5.6 and spring cloud Edgware.RELEASE.
Any help please?
Thanks
It seems spring.cloud.config.uri in spring boot 2.0.1.RELEASE always looking for port 8888 and not accepting other values, so I put the below configuration (you can ignore it, as it is the default value for the client, and the server should run on port 8888)
spring:
cloud:
config:
uri: http://localhost:8888
I also tried to expose all other services in the client for testing as follows
management:
endpoints:
web:
exposure:
include: '*'
or use the following to allow only refresh
management:
endpoints:
web:
exposure:
include: refresh
Then called POST method not GET for refreshing
$ curl -X POST localhost:8080/actuator/refresh -d {} -H "Content-Type: application/json"
Finally, it works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With