0

I have been using environment variables to set Eureka client service url for my Spring Boot 1.5 application.

Environment=eureka_client_serviceUrl_defaultZone=http://myhost1:8761/eureka/,http://myhost2:8761/eureka/

However, this stopped working after upgrading to Spring Boot 2.

I have tried other combinations but none works.

eureka_client_service_url_defaultZone
eureka_client_service_Url_defaultZone
EUREKA_CLIENT_SERVICEURL_defaultZone
EUREKA_CLIENT_SERVICE_URL_defaultZone
EUREKA_CLIENT_SERVICEURL_DEFAULTZONE
EUREKA_CLIENT_SERVICEURL_DEFAULT_ZONE
EUREKA_CLIENT_SERVICE_URL_DEFAULTZONE
EUREKA_CLIENT_SERVICE_URL_DEFAULT_ZONE

Does anyone know why?

Is it because eureka.client.serviceUrl is actually a HashMap, and the recently tighten-up relaxed binding does not work for HashMap with a key consisting of multiple words (i.e. defaultZone)?

wltheng
  • 750
  • 1
  • 11
  • 26
  • 1
    It sounds like you are correct; it is because camel-case keys are all lowercase when bound to the map (`defaultzone`), but Spring tries to read it as `defaultZone`. Try the workaround at the bottom: https://github.com/spring-cloud/spring-cloud-netflix/issues/2541 – George Andrews May 21 '18 at 14:06
  • Thanks for pointing out the existing issue in `spring-cloud-netflix` GitHub! Yea the workaround will work. Guess I will have to stick with the workaround until it is fixed. – wltheng May 21 '18 at 14:13

0 Answers0