I'm building microservices using Spring Boot & Spring Cloud Config. From the log file, I can see one of my application send a request to config service for configuration every five minutes while other applications do not play the same behaviour.
06:04:28.586 [serviceId:xxx-service/traceId:545d584f10da3123/spanId:545d584f10da3123/parentId:] INFO o.s.c.c.c.ConfigServicePropertySourceLocator.getRemoteEnvironment - Fetching config from server at : http://config-service
06:04:30.135 [serviceId:xxx-service/traceId:545d584f10da3123/spanId:545d584f10da3123/parentId:] INFO o.s.c.c.c.ConfigServicePropertySourceLocator.log - Located environment: name=xxxservice, profiles=[dev], label=master, version=00ed4aebcd466c88b4a7df61296652944642cdc8, state=null
06:09:30.367 [serviceId:xxx-service/traceId:519fdde3a2d8ce5a/spanId:519fdde3a2d8ce5a/parentId:] INFO o.s.c.c.c.ConfigServicePropertySourceLocator.getRemoteEnvironment - Fetching config from server at : http://config-service
06:09:31.928 [serviceId:xxx-service/traceId:519fdde3a2d8ce5a/spanId:519fdde3a2d8ce5a/parentId:] INFO o.s.c.c.c.ConfigServicePropertySourceLocator.log - Located environment: name=xxxservice, profiles=[dev], label=master, version=00ed4aebcd466c88b4a7df61296652944642cdc8, state=null
06:14:32.035 [serviceId:xxx-service/traceId:e32c45c3a5c3fcca/spanId:e32c45c3a5c3fcca/parentId:] INFO o.s.c.c.c.ConfigServicePropertySourceLocator.getRemoteEnvironment - Fetching config from server at : http://config-service
06:14:33.611 [serviceId:xxx-service/traceId:e32c45c3a5c3fcca/spanId:e32c45c3a5c3fcca/parentId:] INFO o.s.c.c.c.ConfigServicePropertySourceLocator.log - Located environment: name=xxxservice, profiles=[dev], label=master, version=00ed4aebcd466c88b4a7df61296652944642cdc8, state=null
06:19:32.033 [serviceId:xxx-service/traceId:16fc982b0638d4a6/spanId:16fc982b0638d4a6/parentId:] INFO o.s.c.c.c.ConfigServicePropertySourceLocator.getRemoteEnvironment - Fetching config from server at : http://config-service
06:19:33.495 [serviceId:xxx-service/traceId:16fc982b0638d4a6/spanId:16fc982b0638d4a6/parentId:] INFO o.s.c.c.c.ConfigServicePropertySourceLocator.log - Located environment: name=xxxservice, profiles=[dev], label=master, version=00ed4aebcd466c88b4a7df61296652944642cdc8, state=null
06:24:32.036 [serviceId:xxx-service/traceId:f4eae364e2624d58/spanId:f4eae364e2624d58/parentId:] INFO o.s.c.c.c.ConfigServicePropertySourceLocator.getRemoteEnvironment - Fetching config from server at : http://config-service
06:24:33.640 [serviceId:xxx-service/traceId:f4eae364e2624d58/spanId:f4eae364e2624d58/parentId:] INFO o.s.c.c.c.ConfigServicePropertySourceLocator.log - Located environment: name=xxxservice, profiles=[dev], label=master, version=00ed4aebcd466c88b4a7df61296652944642cdc8, state=null
I try to understand this behaviour.
1 Is the bootstrap.yml
of this service distinct to other services, leads the unique behaviour?
No, all services bootstrap.yml
appear to be the same structure without different config keys:
spring:
profiles:
active: dev
cloud:
config:
name: xxxservice
label: master
uri: http://config-service
2 Is this servie trying to refresh its configuration dynamicly and periodly?
No, in order to dynamically refresh the configuration of a spring boot application, we need to:
- put the
@RefreshScope
annotation on the class reading configuration - call with something like
curl -X POST http://xx:8080/refresh
to trigger refresh manually
So there should not be auto refresh behaviour periodly.
The question remaining unresolved, hope someone explain this situation directly or point any error in my statement.