SpringBoot容器相关配置
依赖 接口测试类 @RestController public class HelloController { @GetMapping ( "/hello" ) public String hello ( ) { return "Hello World!" ; } } 我们发现Spring-web中已经包含有 Tomcat 相关依赖 运行工程 通常情况下默认端口是 8080 ,我们可以在 application.properties 修改相关配置 #修改端号 server.port=8081 #修改访问路径 server.servlet.context - path=/alvin #配置 Tomcat URL 编码 server.tomcat.uri - encoding=UTF - 8 更换服务 通常我们Spring-web依赖启动服务是 Tomcat ,也可以更改服务为 jetty 或者 underTow 等其他服务 更换为 jetty 服务 在依赖中用 <exclusion> 将 Tomcat 关闭,然后加入我们需要的依赖就可以了,如这里换成了 jetty 依赖 < dependency > < groupId > org . springframework . boot < / groupId > < artifactId > spring - boot -