Filter WebServerInitializedEvent for web-only. (#3514)
Filter WebServerInitializedEvent for web-only, excluding management. Fixes gh-2732
This commit is contained in:
committed by
Spencer Gibb
parent
066ffa3fea
commit
4145df96dc
@@ -119,11 +119,14 @@ public class EurekaAutoServiceRegistration implements AutoServiceRegistration, S
|
||||
@EventListener(WebServerInitializedEvent.class)
|
||||
public void onApplicationEvent(WebServerInitializedEvent event) {
|
||||
// TODO: take SSL into account
|
||||
int localPort = event.getWebServer().getPort();
|
||||
if (this.port.get() == 0) {
|
||||
log.info("Updating port to " + localPort);
|
||||
this.port.compareAndSet(0, localPort);
|
||||
start();
|
||||
String contextName = event.getApplicationContext().getServerNamespace();
|
||||
if (contextName == null || !contextName.equals("management")) {
|
||||
int localPort = event.getWebServer().getPort();
|
||||
if (this.port.get() == 0) {
|
||||
log.info("Updating port to " + localPort);
|
||||
this.port.compareAndSet(0, localPort);
|
||||
start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user