介绍两种种简单的修改spring boot内置端口的方法:

第一种:在入口直接设置端口,代码如下所示:

public static void main(String[] args){
        SpringApplication.run(TestSpringBoot.class, "--server.port=9999");
    }

 

第二种:步骤如下:

1、

修改Spring boot内置的tomcat端口

2、

修改Spring boot内置的tomcat端口

3、Apply一下重新运行main方法即可访问新端口

 

相关文章: