Config server and eureka server in same application: tries to connect to localhost:8761

Could you try to change your configuration like below

eureka:
  client:
    registerWithEureka: false
    fetchRegistry: false
    service-url:
      defaultZone: http://localhost:8888/eureka

You specify server.port: 8888. So your eureka is running on 8888 port. But you didn't specify any service-url for eureka. So I think that your eureka server is trying to replicate to localhost:8761 because it's default and you didn't specify service-url for eureka.


Please Use 8761 port for your Eureka server as below.

server:
  port: 8761
eureka:
  client:
    registerWithEureka: false
    fetchRegistry: false

Here we’re configuring an application port – 8761 is the default one for Eureka servers. We are telling the built-in Eureka Client not to register with ‘itself’, because our application should be acting as a server.


For me, below properties that worked for me.

eureka.client.registerWithEureka= false
eureka.client.fetchRegistry= false
eureka.server.maxThreadsForPeerReplication=0