美文网首页
springboot2.0 获取启动端口号

springboot2.0 获取启动端口号

作者: 邓启翔 | 来源:发表于2018-03-20 10:03 被阅读0次

如下:

>public class ConfSerivce  implements ApplicationListener<WebServerInitializedEvent>{
>@Override
>   public void onApplicationEvent(WebServerInitializedEvent event) {
>       try {
>           int port = event.getWebServer().getPort();
>           
>       } catch (Exception e) {
>           e.printStackTrace();
>       }
>   }
>}

相关文章

网友评论

      本文标题:springboot2.0 获取启动端口号

      本文链接:https://www.haomeiwen.com/subject/msjvqftx.html