spring-boot怎么更改默认的端口号
2017-11-20 15:07
471 查看
方法一:可以通过实现EmbeddedServletContainerCustomizer接口来实现,代码:
package com.springboot1; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer; import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer; @SpringBootApplication public class Springboot1Application implements EmbeddedServletContainerCustomizer { public static void main(String[] args) { SpringApplication.run(Springboot1Application.class, args); } @Override public void customize(ConfigurableEmbeddedServletContainer configurableEmbeddedServletContainer) { configurableEmbeddedServletContainer.setPort(8011); } }
方法二:更加简单
在src/resource下增加文件application.properties
加入server.port=8081
即可
相关文章推荐
- SpringBoot修改默认端口号
- SpringBoot修改默认端口号
- win10系统怎么改IIS默认端口号?win10更改IIS默认端口号方法
- SpringBoot修改默认端口号
- SpringBoot项目在Spring Tool Suite中更改默认发布目录为Tomcat
- spring boot项目编译出来的jar包如何更改端口号
- tomcat更改默认端口号
- 怎么更改IE8查看源文件的默认打开的编辑,比如EditPlus
- 10. 修改端口号【从零开始学Spring Boot】
- Spring Boot 使用 jetty 作为默认的Web容器
- maven工程使用spring-boot-devtools进行热部署,更改代码避免重启web容器
- springboot 默认异常处理
- Spring Boot 不使用默认的 parent,改用自己的项目的 parent
- Springboot怎么访问html页面
- spring boot内嵌tomcat配置端口更改
- spring boot内嵌tomcat配置端口更改
- Spring Boot默认的日志格式
- jenkins 图文教程 下载 --》安装--》更改默认端口号,附自启动脚本
- ClouderManager集群在Linux里浏览器默认是英文,在Win里浏览器是中文,怎么更改?(图文详解)
- Spring Boot 不使用默认的 parent,改用自己的项目的 parent