spring_reference/IX. ‘How-to’ guides/64.11. Use Undertow instead...

8 lines
896 B
Markdown
Raw Normal View History

### 64.11. 改变HTTP端口
在一个单独的应用中主HTTP端口默认为8080但可以使用`server.port`设置比如在application.properties中或作为一个系统属性。由于`Environment`值的宽松绑定,你也可以使用`SERVER_PORT`比如作为一个OS环境变
为了完全关闭HTTP端点但仍创建一个WebApplicationContext你可以设置`server.port=-1`(测试时可能有用)。
想获取更多详情可查看'Spring Boot特性'章节的[Section 26.3.3, “Customizing embedded servlet containers”](http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#boot-features-customizing-embedded-containers),或[ServerProperties](http://github.com/spring-projects/spring-boot/tree/master/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java)源码。