Java 类org.springframework.boot.web.context.WebServerInitializedEvent 实例源码

项目:spring-cloud-commons    文件:AbstractAutoServiceRegistration.java   
@EventListener(WebServerInitializedEvent.class)
public void bind(WebServerInitializedEvent event) {
    ApplicationContext context = event.getApplicationContext();
    if (context instanceof ServletWebServerApplicationContext) {
        if ("management".equals(
                ((ServletWebServerApplicationContext) context).getNamespace())) {
            return;
        }
    }
    this.port.compareAndSet(0, event.getWebServer().getPort());
    this.start();
}
项目:spring-boot-admin    文件:DefaultApplicationFactory.java   
@EventListener
public void onWebServerInitialized(WebServerInitializedEvent event) {
    if ("server".equals(event.getServerId())) {
        localServerPort = event.getWebServer().getPort();
    }
    if ("management".equals(event.getServerId())) {
        localManagementPort = event.getWebServer().getPort();
    }
}
项目:spring-cloud-zookeeper    文件:DependencyConfig.java   
@Override
public void onApplicationEvent(WebServerInitializedEvent event) {
    this.port = event.getWebServer().getPort();
}