SpringBoot修改Servlet相关配置
第一种方式在配置文件中进行修改
server.port=8081
server.servlet.context-path=/springboot
server.tomcat.uri-encoding=utf-8
#SpringBoot自动为我们配置DispatcherServlet,默认拦截"/"(所有请求,包括静态资源,但不拦截jsp请求,若要拦截
# Jsp请求,修改配置为“/*”即可)
spring.mvc.servlet.path=/*
第二种方式在配置类中进行修改
package cn.coreqi.config; import org.springframework.boot.web.server.WebServerFactoryCustomizer;
import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; @Configuration
public class ServletConfig { //SpringBoot1.x使用EmbeddedServletContainerCustomizer
@Bean
public WebServerFactoryCustomizer webServerFactoryCustomizer(){
return new WebServerFactoryCustomizer<ConfigurableServletWebServerFactory>(){
@Override
public void customize(ConfigurableServletWebServerFactory factory) {
factory.setPort(8082);
}
};
}
}
SpringBoot修改Servlet相关配置的更多相关文章
- IntelliJ IDEA 2017版 spring-boot修改端口号配置把端口号改为8081
1.修改端口号主要是通过配置文件修改.如图: 完整版配置 ######################################################## ###server 配置信息 ...
- springboot 2.x相关配置
1.在配置文件中进行配置 #############指定项目中所有的日期类型返回json格式########### spring.jackson.date-format=yyyy-MM-dd HH:m ...
- Servlet相关配置
配置方式 webXML 定义标签<urlpartten>Servlet访问路径 注解 定义的<urlpartten>数组:可以为一个servlet定义多个访问路径. packa ...
- SpringBoot嵌入式Servlet容器
SpringBoot默认是将Tomcat作为嵌入式的servlet容器. 问题: 如何修改嵌入式的servlet容器? 1)在配置文件中设置对应的属性值 server.port=8081 # Tomc ...
- Linux网络相关配置
一.修改网卡相关配置 Linux网络参数是在/etc/sysconfig/network-scripts/ifcfg-eth0中设置,其中ifcfg-eth0表示是第一个网卡,如果还有另外一块网卡,则 ...
- Servlet相关学习
Servlet入门解析 概念 运行在服务器端的小程序 servlet就是一个接口,定义了Java类被浏览器访问到(tomcat识别)的规则 实现servlet接口.复写方法 快速入门 创建web项目 ...
- springboot配置server相关配置&整合模板引擎Freemarker、thymeleaf&thymeleaf基本用法&thymeleaf 获取项目路径 contextPath 与取session中信息
1.Springboot配置server相关配置(包括默认tomcat的相关配置) 下面的配置也都是模板,需要的时候在application.properties配置即可 ############## ...
- SpringBoot定制修改Servlet容器
1.如何修改Servlet容器的相关配置: 第一种:在application.properties中修改和server有关的配置(ServerProperties提供): server.port=80 ...
- SpringBoot嵌入式Servlet配置原理
SpringBoot嵌入式Servlet配置原理 SpringBoot修改服务器配置 配置文件方式方式修改,实际修改的是ServerProperties文件中的值 server.servlet.con ...
随机推荐
- poj1753 【枚举】
Flip game is played on a rectangular 4x4 field with two-sided pieces placed on each of its 16 square ...
- CUBA如何新增ServiceBean
简单的方法 在页面MIDDLEWARE模块,可以直接新建.编辑.删除 复杂的方法 在代码中手动实现,则需要1.添加Serviceweb-spring.xml中,添加 <entry key=&qu ...
- tmux的使用
tmux的使用 1: tmux的介绍 tmux是一个优秀的终端多路复用软件,类似GNU Screen,但来自于OpenBSD,采用BSD授权.使用它最直观的好处就是,通过一个终端登录远程主机并 ...
- MT【64】2017联赛一试不等式的一个加强练习
已知$x_1,x_2,x_3\ge0,x_1+x_2+x_3=1$求 $$(x_1+3x_2+5x_3)(x_1+\frac{1}{3}x_2+\frac{1}{5}x_3)(x_1+x_3+3x_2 ...
- 【CodeForces 624D/623B】Array GCD
题 You are given array ai of length n. You may consecutively apply two operations to this array: remo ...
- Android recording 录音功能 简单使用小实例
package com.app.recordingtest; import java.io.File; import java.io.IOException; import android.app.A ...
- 教你如何开启/关闭ubuntu防火墙
目录 [隐藏] 1 安装方法 2 使用方法 3 推荐设置 4 详细使用说明 安装方法 sudo apt-get install ufw 当然,这是有图形界面的(比较简陋),在新立得里搜索gufw试 ...
- bzoj4361 isn (dp+树状数组+容斥)
我们先设f[i][j]表示长度为i,以j结尾的不降子序列个数,$f[i][j]=\sum{f[i-1][k]},A[k]<=A[j],k<j$,用树状数组优化一下可以$O(n^2logn) ...
- Yosimite10.10(Mac os)安装c/c++内存检测工具valgrind
1.下载支持包m4-1.4.13.tar.gz $ curl -O http://mirrors.kernel.org/gnu/m4/m4-1.4.13.tar.gz 2. 解压m4-1.4.13.t ...
- Hibernate_事务管理
今天学习Hibernate,发现当我在执行下面操作时,不会对数据库产生任何效果,就是说Customer对象并不会保存到数据库中 Session session = HibernateUtils.ope ...