Update namespace method
This commit is contained in:
@@ -1,16 +1,10 @@
|
||||
package org.springframework.cloud.client.serviceregistry;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.boot.web.context.ConfigurableWebServerApplicationContext;
|
||||
import org.springframework.boot.web.context.WebServerInitializedEvent;
|
||||
import org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext;
|
||||
import org.springframework.cloud.client.discovery.ManagementServerPortUtils;
|
||||
import org.springframework.cloud.client.discovery.event.InstanceRegisteredEvent;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
@@ -18,6 +12,10 @@ import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.context.event.EventListener;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
||||
import javax.annotation.PreDestroy;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
/**
|
||||
* Lifecycle methods that may be useful and common to {@link ServiceRegistry}
|
||||
* implementations.
|
||||
@@ -65,9 +63,9 @@ public abstract class AbstractAutoServiceRegistration<R extends Registration>
|
||||
@EventListener(WebServerInitializedEvent.class)
|
||||
public void bind(WebServerInitializedEvent event) {
|
||||
ApplicationContext context = event.getApplicationContext();
|
||||
if (context instanceof ServletWebServerApplicationContext) {
|
||||
if (context instanceof ConfigurableWebServerApplicationContext) {
|
||||
if ("management".equals(
|
||||
((ServletWebServerApplicationContext) context).getNamespace())) {
|
||||
((ConfigurableWebServerApplicationContext) context).getServerNamespace())) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user