SpringBoot定制修改Servlet容器
1.如何修改Servlet容器的相关配置:
第一种:在application.properties中修改和server有关的配置(ServerProperties提供);
server.port=8081
server.context‐path=/crud
server.tomcat.uri‐encoding=UTF‐8
//通用的Servlet容器设置
server.xxx
//Tomcat的设置
server.tomcat.xxx
第二种:编写一个EmbeddedServletContainerCustomizer(嵌入式Servlet容器定制器);
@Bean
public EmbeddedServletContainerCustomizer embeddedServletContainerCustomizer(){
return new EmbeddedServletContainerCustomizer() {
//定制嵌入式的Servlet容器相关的规则
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {//传入一个可配置的嵌入式容器
container.setPort(8083);
}
};
}
2.如何更改默认servlet容器
该默认Tomcat为Jetty,也可以更改为Undertow
<!‐‐ 引入web模块 ‐‐>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring‐boot‐starter‐web</artifactId>
<exclusions>
<exclusion>
<!‐‐去除其Tomcat容器‐‐>
<artifactId>spring‐boot‐starter‐tomcat</artifactId>
<groupId>org.springframework.boot</groupId>
</exclusion>
</exclusions>
</dependency>
<!‐‐引入其他的Servlet容器‐‐>
<dependency>
<artifactId>spring‐boot‐starter‐jetty</artifactId>
<groupId>org.springframework.boot</groupId>
</dependency>
SpringBoot定制修改Servlet容器的更多相关文章
- java框架之SpringBoot(8)-嵌入式Servlet容器
前言 SpringBoot 默认使用的嵌入式 Servlet 容器为 Tomcat,通过依赖关系就可以看到: 问题: 如何定制和修改 Servlet 容器相关配置? SpringBoot 能否支持其它 ...
- springboot(八) 嵌入式Servlet容器自动配置原理和容器启动原理
1.嵌入式Servlet容器自动配置原理 1.1 在spring-boot-autoconfigure-1.5.9.RELEASE.jar => springboot自动配置依赖 jar包下,E ...
- SpringBoot(七) -- 嵌入式Servlet容器
一.嵌入式Servlet容器 在传统的开发中,我们在完成开发后需要将项目打成war包,在外部配置好TomCat容器,而这个TomCat就是Servlet容器.在使用SpringBoot开发时,我们无需 ...
- SpringBoot配置嵌入式Servlet容器
1).如何定制和修改Servlet容器的相关配置: 1.修改和server有关的配置(ServerProperties[也是EmbeddedServletContainerCustomizer]): ...
- springboot外置的Servlet容器
嵌入式Servlet容器:应用打成可执行的jar 优点:简单.便携: 缺点:默认不支持JSP.优化定制比较复杂(使用定制器[ServerProperties.自定义EmbeddedServle ...
- 尚硅谷springboot学习25-嵌入式Servlet容器
SpringBoot默认使用Tomcat作为嵌入式的Servlet容器:
- springboot(七) 配置嵌入式Servlet容器
github代码地址:https://github.com/showkawa/springBoot_2017/tree/master/spb-demo/spb-brian-query-service ...
- SpringBoot源码学习系列之嵌入式Servlet容器
目录 1.博客前言简单介绍 2.定制servlet容器 3.变换servlet容器 4.servlet容器启动原理 SpringBoot源码学习系列之嵌入式Servlet容器启动原理 @ 1.博客前言 ...
- SpringBoot起飞系列-配置嵌入式Servlet容器(八)
一.前言 springboot中默认使用的是tomcat容器,也叫做嵌入式的servlet容器.因为它和我们平常使用的tomcat容器不一样,这个tomcat直接嵌入到的springboot,平常我们 ...
随机推荐
- Pandas之数据结构
pandas入门 由于最近公司要求做数据分析,pandas每天必用,只能先跳过numpy的学习,先学习大Pandas库 Pandas是基于Numpy构建的,让以Numpy为中心的应用变得更加简单 pa ...
- eclipse环境的搭建(转载)
原文地址:http://hanqunfeng.iteye.com/blog/982182 此文章发表于2011年到2012年 使用eclipse真的有年头了,相信java程序员没有不知道它的,最近在给 ...
- rancher2 HA部署注意事项
参考: https://rancher.com/docs/rancher/v2.x/en/installation/ha-server-install/ https://www.cnblogs.com ...
- Centos 下使用VLAN+Bridge 搭建KVM基础网络环境
一.使用环境介绍 宿主机上同时运行多网段虚拟机,为了解决宿主机网卡资源紧张问题,采用如下网络模式:(本实验vlan 105:192.168.5.x vlan108:192.168.8.x) 二. ...
- Shell教程 之流程控制
1. if else 1.1 if if语句语法格式: if condition then command1 command2 ... commandN fi 写成一行(适用于终端命令提示符): if ...
- <asp:Button点击查询后,调用js中函数展现加载圈
<div> <div id='paneloading' style='display:none;position:fixed;top:0px;left:0px;z-index:999 ...
- PHP如何处理yyyyMMddHHmmssSSSZ?
PHP如何处理yyyyMMddHHmmssSSSZ? 更新: 2016-01-05 12:45 作者: wecandoitforev PHP编程中,时间,日期的应用是必不可少的.有一种日期格式:yyy ...
- CodeForces - 55D(数位dp,离散化)
题目来源:http://codeforces.com/problemset/problem/55/D Volodya is an odd boy and his taste is strange as ...
- 截图原理(一)——Android自动化测试学习历程
把两节的内容汇总起来,第一节讲的是如何在apk中直接进行截屏,用到了Robotium的Solo类的takeScreenShot方法,有一个小的demo,以及从方法一直往里钻,知道它具体是怎么进行截屏的 ...
- Unicode编码字符范围和具体文字
1)标准CJK文字 http://www.unicode.org/Public/UNIDATA/Unihan.html 2)全角ASCII.全角中英文标点.半宽片假名.半宽平假名.半宽韩文字母:FF0 ...