I was able to solve this issue. Basically all your microservices should use below configuration. Here prefer-ip-address: true
and fetch-registry: true
is the key here.
server:
port: 8002
spring:
application:
name: user-service
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/test
username: root
password: root
jpa:
generate-ddl: true
hibernate:
ddl-auto: create
# zipkin:
# base-url: http://127.0.0.1:9411/
eureka:
client:
register-with-eureka: true
fetch-registry: true
instance:
prefer-ip-address: true
hostname: localhost