spring-cloud / spring-cloud/spring-cloud-config

In Eureka First Bootstrap mode, config data wouldn't load if a client starts on a random port number

Open
#93 21 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

closable enhancement
Dominant language
Java
Stars
2k
Forks
1.3k
Avg merge
2d 59m
Merged PRs (30d)
16

Description

In Eureka First mode, if client starts on a random port (--server.port=0), the client code will ignore the Eureka setup and always try to load config data from default location (localhost:8888). In my case, I have config server runs on 8810, and the client bootstrap as,

spring.application.name=test-server
server.port=0

spring.cloud.config.discovery.enabled=true
spring.cloud.config.discovery.serviceId=config-server

eureka.client.serviceUrl.defaultZone=http://localhost:8020/eureka/
eureka.instance.metadataMap.instanceId=${spring.application.name}:${spring.application.instance_id:${random.value}}

Here is the error when my client bootup,

2015-02-26 14:11:30.320 ERROR 21609 --- [           main] c.c.c.ConfigServicePropertySourceLocator : Could not locate PropertySource: I/O error on GET request for "http://localhost:8888/test-server/default/master":Connection refused; nested exception is java.net.ConnectException: Connection refused

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with ConfigServicePropertySourceLocator and the bootstrap handling for Eureka First mode, using the configuration shown in the issue with a random server port and a config server on port 8810. Reproduce the failed lookup and trace why it falls back to localhost:8888; done means config data is loaded through Eureka service discovery instead.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring, spring-boot
Domain
backend, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.