spring-cloud / spring-cloud-consul

Spring Cloud Consul
http://cloud.spring.io/spring-cloud-consul/
Apache License 2.0
812 stars 541 forks source link

Register service using spring cloud config server properties #607

Closed roll57 closed 4 years ago

roll57 commented 4 years ago

I want to setup the server.servlet.context-path in the spring cloud config server. I also need then to setup the property for the health-check to be health-check-path: ${server.servlet.context-path}/health

When the service is auto-register on startup it contains the metadata with the correct server.servlet.context-path but the health-check-path is the default one.

I notice that if want to change others property it does not work neither.

Looks like the servlet-context-path is correct because it is not loaded directly from the configurationProperties but by the following class org.springframework.cloud.consul.serviceregistry.ConsulServletRegistrationCustomizer#customize

my config server use the following file

server.servlet.context-path=/custom/path
spring.cloud.consul.discovery.health-check-path=${server.servlet.context-path}/health

When the service auto-registered I have the following log.

NewService{... contextPath=/custom/path], check=Check{...., http='.../actuator/health'...}, ...}

The service is registered by org.springframework.cloud.consul.serviceregistry.ConsulAutoServiceRegistrationListener at this time the config has been loaded from the config server, should the properties not been refreshed?

TYsewyn commented 4 years ago

Can you provide a complete, minimal, verifiable sample that reproduces the problem? It should be available as a GitHub (or similar) project or attached to this issue as a zip file. Also, which version of Spring Boot and Spring Cloud are you using?

spring-projects-issues commented 4 years ago

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

spring-projects-issues commented 4 years ago

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.