I'm using spring cloud eureka for microservice registration in a dockerised environment on aws.
As i'm using dockers ephemeral port mapping the port exposed on the container host is unknown. To overcome that i've a custom EurekaInstanceConfigBean
that asks the docker daemon on the host for the assigned port so i can use that to register with eureka.
That all works fine until registration starts. The EurekaDiscoveryClientConfiguration
contains a @EventListener(EmbeddedServletContainerInitializedEvent.class)
that overrides the external port i've assigned in my custom EurekaInstanceConfigBean
and sets it back to the local port inside the container.
I think the listeners purpose is to support auto port assignment in case of server.port=0
but in my setup it's breaking things.
The question is: Can i somehow stop the EurekaDiscoveryClientConfiguration
to override my manually set port? Can i somehow use my own EurekaDiscoveryClientConfiguration
?