package com.yihu.hos.common.configuration;

import org.springframework.boot.context.embedded.EmbeddedServletContainerInitializedEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.Configuration;

/**
 * @created Airhead 2016/8/1.
 */
@Configuration
public class ApplicationConfiguration implements ApplicationListener<EmbeddedServletContainerInitializedEvent> {

    private int port;

    @Override
    public void onApplicationEvent(EmbeddedServletContainerInitializedEvent event) {
        port = event.getEmbeddedServletContainer().getPort();
    }

    public int getPort() {
        return port;
    }
}
