When I change a value from my properties repository and restart the Spring Cloud Config Server, the changes do not reflect on it's consumers.
my-microservice/application.properties:
spring.application.name=my-service
spring.cloud.config.uri=http://localhost:8888
MyServiceController.java
@RestController
public class MyServiceController {
@Autowired
private Configuration configuration;
@GetMapping("/my-service")
public MyServiceBean retrieveMyServiceProperties() {
// show propertie's values
return new MyServiceBean(configuration.getPropertie1(), configuration.getPropertie2());
}
}
spring-cloud-config-server/application.properties
server.port=8888
spring.application.name=spring-cloud-config-server
spring.cloud.config.server.git.uri=file://path
Git repo
my-service.properties
my-service.propertie1=1
my-service.propertie2=2
When I send a GET request to localhost:8080/my-service, that's the result I got:
{
"propertie1":1,
"propertie2":2
}
Fine, that's OK!
But, if I change the my-service.properties
and restart my Spring Cloud Config Server, the changes do not reflect MyServiceController
. I do need to restart my-microservice application, for changes to take effect.
Is this the normal behavior? I mean, if this is remote, then, it should be configured whether to cache or not.
/refresh
actuator endpoint on the client – spencergibb