class ServiceInfo implements ApplicationListener<WebServerInitializedEvent> {

    private final Logger logger = LoggerFactory.getLogger(ServiceInfo.class);

    private static int serverPort;

    public static int getServerPort() {
        return serverPort;
    }

    @Override
    public void onApplicationEvent(WebServerInitializedEvent event) {<FILL_FUNCTION_BODY>}

    public void setServerPort(int serverPort) {
        ServiceInfo.serverPort = serverPort;
    }
}

        // 项目启动获取启动的端口号
        ServiceInfo.serverPort = event.getWebServer().getPort();
        logger.info("项目启动获取启动的端口号:  " + ServiceInfo.serverPort);
    
<no_super_class>