精华内容
下载资源
问答
  • 我们都知道,SpringBoot内置了容器Tomcat,可以直接启动WebServletServer,那么SpringBoot是如何启动Tomcat的? 本文从Main方法入手,从SpringApplication.run跟到ServletWebServerApplicationContext 再到...

    前言

    我们都知道,SpringBoot内置了容器Tomcat,可以直接启动WebServletServer,那么SpringBoot是如何启动Tomcat的?
    本文从Main方法入手,从SpringApplication.run跟到ServletWebServerApplicationContext 再到TomcatServletWebServerFactory,破解SpringBoot Tomcat启动之谜 !!!

    • springboot版本 : 2.0.5.RELEASE
    • 追踪工具 : IDEA

    Main方法

    @SpringBootApplication
    public class DemoApplication {
    	public static void main(String[] args) {
    		SpringApplication.run(DemoApplication .class,args);
    	}
    }
    

    Run方法

    	/**
    	 * Run the Spring application, creating and refreshing a new
    	 * {@link ApplicationContext}.
    	 * @param args the application arguments (usually passed from a Java main method)
    	 * @return a running {@link ApplicationContext}
    	 * 解释 by zhengkai.blog.csdn.net
    	 */
    	public ConfigurableApplicationContext run(String... args) {
    	    //zhengkai.blog.csdn.net
    		//定义个StopWatch,Wathch是表,定义个表来监控一下运行的性能,用了多少ms
    		StopWatch stopWatch = new StopWatch();
    		//开始计时
    		stopWatch.start();
    		//定义一个可配置的上下文,ConfigurableApplicationContext接口extends了ApplicationContext+Lifecycle+Closeable,可以被大多数的应用上下文实现,为配置应用上下文提供便利.
    		ConfigurableApplicationContext context = null;
    		//ExceptionReporter明显是一个错误报告,for SpringApplication的starup error,基本只是启动的报错(不包括启动后的报错)
    		Collection<SpringBootExceptionReporter> exceptionReporters = new ArrayList<>();
    		configureHeadlessProperty();
    		//RunListeners,运行监听器SpringApplicationRunListeners=List<SpringApplicationRunListener>,是个集合来的
    		//包括starting()environmentPrepared()contextPrepared()contextLoaded()started()running()failed()事件的监听
    		SpringApplicationRunListeners listeners = getRunListeners(args);
    		//进入监听器的staring阶段
    		listeners.starting();
    		try {
    		    //获取SpringBootApplication的运行参数,如果你是java -jar xxx.jar --server.context-path=/mypath,则可以动态获取
    			ApplicationArguments applicationArguments = new DefaultApplicationArguments(
    					args);
    			//开始准备环境,传入监听器和运行参数,获得环境变量,可以getSystemEnvironment和getSystemProperties,可以setActiveProfiles设置激活的配置
    			ConfigurableEnvironment environment = prepareEnvironment(listeners,
    					applicationArguments);
    		    //从spring.beaninfo.ignore获取需要忽然的bean列表
    			configureIgnoreBeanInfo(environment);
    			//打印banner,控制台输出,Mode有三种:OFF/console/log file
    			Banner printedBanner = printBanner(environment);
    			//***开始创建上下文,这个比较重点,下面列出来单独说
    			//根据webApplicationType,获取对应的CONTEXT_CLASS,分SERVLET(Web)/REACTIVE(webflux)/default(spring).开始创建上下文
    			context = createApplicationContext();
    			//里面实际上创建了SpringFactoriesInstances
    			exceptionReporters = getSpringFactoriesInstances(
    					SpringBootExceptionReporter.class,
    					new Class[] { ConfigurableApplicationContext.class }, context);
    			//这里才是真正创建上下文的地方:
    			//context.setEnvironment设置环境变量.setResourceLoader设置资源加载器,用context来初始化所有initializer
    			//开始logStartupInfo输出日志,registerArguments注册参数,registerBanner注册控制台输出
    			//createBeanDefinitionLoader创建bean定义加载器,最后load到所有监听器listener上
    			prepareContext(context, environment, listeners, applicationArguments,
    					printedBanner);
    			//这里为context注册一个ShutdownHooK,也就是关掉应用的时候要做什么
    			refreshContext(context);
    			//这是一个空方法,可供改造???
    			afterRefresh(context, applicationArguments);
    			//好了,计时停止,看下启动用了多少ms
    			stopWatch.stop();
    			if (this.logStartupInfo) {
    				//输出SpringBoot那些启动信息,日志,用了多少ms等,你平常看到的那堆
    				new StartupInfoLogger(this.mainApplicationClass)
    						.logStarted(getApplicationLog(), stopWatch);
    			}
    			//进入监听器的启动完成事件
    			listeners.started(context);
    			//分ApplicationRunner和CommandLineRunner,callback run
    			callRunners(context, applicationArguments);
    		}
    		catch (Throwable ex) {
    		    //万一启动过程中有报错,就handleExitCode然后reportFailure,然后重新抛出RuntimeException
    			handleRunFailure(context, ex, exceptionReporters, listeners);
    			throw new IllegalStateException(ex);
    		}
    
    		try {
    		    //进入监听器的running运行中阶段
    			listeners.running(context);
    		}
    		catch (Throwable ex) {
    		    //万一有报错怎么办,跟上面一样......
    			handleRunFailure(context, ex, exceptionReporters, null);
    			throw new IllegalStateException(ex);
    		}
    		//搞定,,,返回上下文!
    		return context;
    	}
    

    抓住createApplicationContext

    大致过了一遍之后,我觉得我们应该关注这个方法,createApplicationContext()

    	/**
    	 * Strategy method used to create the {@link ApplicationContext}. By default this
    	 * method will respect any explicitly set application context or application context
    	 * class before falling back to a suitable default.
    	 * @return the application context (not yet refreshed)
    	 * @see #setApplicationContextClass(Class)
    	 */
    	protected ConfigurableApplicationContext createApplicationContext() {
    		Class<?> contextClass = this.applicationContextClass;
    		if (contextClass == null) {
    			try {
    				switch (this.webApplicationType) {
    				case SERVLET:
    					//DEFAULT_WEB_CONTEXT_CLASS=org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext
    					contextClass = Class.forName(DEFAULT_WEB_CONTEXT_CLASS);
    					break;
    				case REACTIVE:
    					//org.springframework.boot.web.reactive.context.AnnotationConfigReactiveWebServerApplicationContext
    					contextClass = Class.forName(DEFAULT_REACTIVE_WEB_CONTEXT_CLASS);
    					break;
    				default:
    					//org.springframework.context.annotation.AnnotationConfigApplicationContext
    					contextClass = Class.forName(DEFAULT_CONTEXT_CLASS);
    				}
    			}
    			catch (ClassNotFoundException ex) {
    				throw new IllegalStateException(
    						"Unable create a default ApplicationContext, "
    								+ "please specify an ApplicationContextClass",
    						ex);
    			}
    		}
    		return (ConfigurableApplicationContext) BeanUtils.instantiateClass(contextClass);
    	}
    

    CONTEXT_CLASS分析

    DEFAULT_WEB_CONTEXT_CLASS=org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext

    DEFAULT_WEB_CONTEXT_CLASS一路跟踪到extends的类,直到发现新大陆:

    //没什么可以看
    public class AnnotationConfigServletWebServerApplicationContext
    		extends ServletWebServerApplicationContext implements AnnotationConfigRegistry{
    }		
    //重点: 整理by zhengkai.blog.csdn.net
    public class ServletWebServerApplicationContext extends GenericWebApplicationContext
    		implements ConfigurableWebServerApplicationContext{
    		//放眼一望,这个里面也相当丰富,很多内容
    		//发现WebServer
    		private volatile WebServer webServer;
    		//发现ServletConfig
    		private ServletConfig servletConfig;
    		//发现创建WebServer的方法
    		private void createWebServer() {
    			WebServer webServer = this.webServer;
    			//Servlet上下文
    			ServletContext servletContext = getServletContext();
    			//有server和上下文,则不需要创建,直接从ServletWebServer工厂里面拿
    			if (webServer == null && servletContext == null) {
    				//ServletWebServerFactory工厂,应该有很多东西,提到下面来分析
    				ServletWebServerFactory factory = getWebServerFactory();
    				this.webServer = factory.getWebServer(getSelfInitializer());
    			}
    			else if (servletContext != null) {
    				try {
    				   //没有话,从ServletContextInitializer开始一个吧
    					getSelfInitializer().onStartup(servletContext);
    				}
    				catch (ServletException ex) {
    					throw new ApplicationContextException("Cannot initialize servlet context",
    							ex);
    				}
    		}
    		initPropertySources();
    	}
    }	
    
    //没啥子
    public class GenericWebApplicationContext extends GenericApplicationContext
    		implements ConfigurableWebApplicationContext, ThemeSource {
    }	
    
    //没啥子
    public class GenericApplicationContext extends AbstractApplicationContext implements BeanDefinitionRegistry {
    }
    
    //AbstractApplicationContext 这个类也还是挺大的,虽然是抽象类,但是很多方法,超级丰富,值得关注
    public abstract class AbstractApplicationContext extends DefaultResourceLoader
    		implements ConfigurableApplicationContext {   
    }
    

    ServletWebServerFactory工厂

    IDEA下ctrl+alt+B,直接查看ServletWebServerFactory工厂的实现,发现:
    在这里插入图片描述
    Tomcat启动之谜

    看到上面几个工厂类的时候,这个谜题已经破解了。同时Jetty,Undertow的启动之谜也揭晓了。

    	/**
    	 * 创建并获取TomcatWebServer,TomcatServletWebServerFactory,整理 by zhengkai.blog.csdn.net
    	 */
    	@Override
    	public WebServer getWebServer(ServletContextInitializer... initializers) {
    		Tomcat tomcat = new Tomcat();
    		File baseDir = (this.baseDirectory != null) ? this.baseDirectory
    				: createTempDir("tomcat");
    		tomcat.setBaseDir(baseDir.getAbsolutePath());
    		Connector connector = new Connector(this.protocol);
    		tomcat.getService().addConnector(connector);
    		customizeConnector(connector);
    		tomcat.setConnector(connector);
    		tomcat.getHost().setAutoDeploy(false);
    		configureEngine(tomcat.getEngine());
    		for (Connector additionalConnector : this.additionalTomcatConnectors) {
    			tomcat.getService().addConnector(additionalConnector);
    		}
    		prepareContext(tomcat.getHost(), initializers);
    		//getTomcatWebServer=return new TomcatWebServer(tomcat, getPort() >= 0);
    		return getTomcatWebServer(tomcat);
    	}
    	/**
    	 * 创建并获取JettyWebServer,JettyServletWebServerFactory,整理 by zhengkai.blog.csdn.net
    	 */
    	@Override
    	public WebServer getWebServer(ServletContextInitializer... initializers) {
    		JettyEmbeddedWebAppContext context = new JettyEmbeddedWebAppContext();
    		int port = (getPort() >= 0) ? getPort() : 0;
    		InetSocketAddress address = new InetSocketAddress(getAddress(), port);
    		Server server = createServer(address);
    		configureWebAppContext(context, initializers);
    		server.setHandler(addHandlerWrappers(context));
    		this.logger.info("Server initialized with port: " + port);
    		if (getSsl() != null && getSsl().isEnabled()) {
    			customizeSsl(server, address);
    		}
    		for (JettyServerCustomizer customizer : getServerCustomizers()) {
    			customizer.customize(server);
    		}
    		if (this.useForwardHeaders) {
    			new ForwardHeadersCustomizer().customize(server);
    		}
    		//getJettyWebServer=return new JettyWebServer(server, getPort() >= 0);
    		return getJettyWebServer(server);
    	}
    	/**
    	 * 创建并获取UndertowWebServer,UndertowServletWebServerFactory,整理 by zhengkai.blog.csdn.net
    	 */
    	@Override
    	public WebServer getWebServer(ServletContextInitializer... initializers) {
    		DeploymentManager manager = createDeploymentManager(initializers);
    		int port = getPort();
    		Builder builder = createBuilder(port);
    		//getUndertowWebServer=return new UndertowServletWebServer(builder, manager, getContextPath(),isUseForwardHeaders(), port >= 0, getCompression(), getServerHeader());
    		return getUndertowWebServer(builder, manager, port);
    	}
    	//Undertow做多了一层Builder的封装
    	private Builder createBuilder(int port) {
    		Builder builder = Undertow.builder();
    		if (this.bufferSize != null) {
    			builder.setBufferSize(this.bufferSize);
    		}
    		if (this.ioThreads != null) {
    			builder.setIoThreads(this.ioThreads);
    		}
    		if (this.workerThreads != null) {
    			builder.setWorkerThreads(this.workerThreads);
    		}
    		if (this.directBuffers != null) {
    			builder.setDirectBuffers(this.directBuffers);
    		}
    		if (getSsl() != null && getSsl().isEnabled()) {
    			customizeSsl(builder);
    		}
    		else {
    			builder.addHttpListener(port, getListenAddress());
    		}
    		for (UndertowBuilderCustomizer customizer : this.builderCustomizers) {
    			customizer.customize(builder);
    		}
    		return builder;
    	}
    

    Tomcat vs Jetty vs Undertow

    每个Web容器都有自己的设计和组件:

    • Tomcat是Connector
    • Jetty是Handler
    • Undertow是Builder

    单纯比较 Tomcat 与 Jetty 的性能意义不是很大,只能说在某种使用场景下,它表现的各有差异。因为它们面向的使用场景不尽相同。从架构上来看 Tomcat 在处理少数非常繁忙的连接上更有优势,也就是说连接的生命周期如果短的话,Tomcat 的总体性能更高。

    而 Jetty 刚好相反,Jetty 可以同时处理大量连接而且可以长时间保持这些连接。例如像一些 web 聊天应用非常适合用 Jetty 做服务器,像淘宝的 web 旺旺就是用 Jetty 作为 Servlet 引擎。

    另外 Jetty 默认使用的是 NIO 技术,在处理 I/O 请求上更占优势,Tomcat 默认使用的是 BIO,在处理静态资源时,Tomcat 的性能不如 Jetty。

    =。=Undertow可能大家陌生有点,是一个Java开发的灵活的高性能Web服务器,提供包括阻塞和基于NIO的非阻塞机制。Undertow是红帽公司的开源产品,是Wildfly默认的Web服务器。SpringBoot2中可以将Web服务器切换到Undertow来提高应用性能。

    Undertow认为它的运用场景是在IO密集型的系统应用中,简单点的讲,就是结合了Tomcat和Jetty的优点,类似Netty的强大

    展开全文
  • springboot tomcat配置参数列表

    万次阅读 2018-06-02 10:48:03
    由于springboot是在内部集成了tomcat,所以修改tomcat配置参数也可以在spring的配置文件中设置 本文只是自己作为记录笔记用的,如果要详细的注解,请自己查找。 springboot tomcat的配置选项大全 server. Port = ...

    由于springboot是在内部集成了tomcat,所以修改tomcat配置参数也可以在spring的配置文件中设置

    本文只是自己作为记录笔记用的,如果要详细的注解,请自己查找。

    springboot tomcat的配置选项大全
    server. Port = xxxx
    server. Address =
    server. contextPath =
    server. displayName =
    server. servletPath =
    server. contextParameters =
    server. useForwardHeaders =
    server. serverHeader =
    server. maxHttpHeaderSize =
    server. maxHttpPostSize =
    server. connectionTimeout =
    server. session.timeout =
    server. session.trackingModes =
    server. session.persistent =
    server.session.storeDir =
    server.cookie. name =
    server.cookie. domain =
    server.cookie. path =
    server.cookie. comment =
    server.cookie. httpOnly =
    server.cookie. secure =
    server.cookie. maxAge =
    server. ssl. Enabled =
    server.ssl. clientAuth =
    server.ssl. ciphers =
    server.ssl. enabledProtocols =
    server.ssl. keyAlias =
    server.ssl. keyPassword =
    server.ssl. keyStore =
    server.ssl. keyStorePassword =
    server.ssl. keyStoreType =
    server.ssl. keyStoreProvider =
    server.ssl. trustStore =
    server.ssl. trustStorePassword =
    server.ssl. trustStoreType =
    server.ssl. trustStoreProvider =
    server.ssl. protocol =
    server.compression. enabled =
    server.compression.mimeTypes =
    server.compression.excludedUserAgents =
    server.compression.minResponseSize =
    server. jspServlet. className =
    server.jspServlet. initParameters =
    server.jspServlet.registered =
    server.tomcat.accesslog.enabled =
    server.tomcat.accesslog.pattern =
    server.tomcat.accesslog.directory =
    server.tomcat.accesslog.prefix =
    server.tomcat.accesslog.suffix =
    server.tomcat.accesslog.rotate =
    server.tomcat.accesslog.renameOnRotate =
    server.tomcat.accesslog.requestAttributesEnabled=
    server.tomcat.accesslog.buffered =
    server.tomcat.internalProxies =
    server.tomcat.protocolHeader =
    server.tomcat.protocolHeaderHttpsValue =
    server.tomcat.portHeader =
    server.tomcat.remoteIpHeader=
    server.tomcat.basedir =
    server.tomcat.backgroundProcessorDelay =
    server.tomcat.maxThreads =
    server.tomcat.minSpareThreads =
    server.tomcat.maxHttpPostSize =
    server.tomcat.maxHttpHeaderSize =
    server.tomcat.redirectContextRoot =
    server.tomcat.uriEncoding =
    server.tomcat.maxConnections =
    server.tomcat.acceptCount =
    server.tomcat.additionalTldSkipPatterns =
    展开全文
  • springboot的...springboot tomcat的配置选项大全 server. Port = xxxx server. Address = server. contextPath = server. displayName = server. servletPath = server. contextParameters = server....

    springboot的ServerProperties类可查看默认值

    springboot tomcat的配置选项大全
    server. Port = xxxx
    server. Address =
    server. contextPath =
    server. displayName =
    server. servletPath =
    server. contextParameters =
    server. useForwardHeaders =
    server. serverHeader =
    server. maxHttpHeaderSize =
    server. maxHttpPostSize =
    server. connectionTimeout =
    server. session.timeout =
    server. session.trackingModes =
    server. session.persistent =
    server.session.storeDir =
    server.cookie. name =
    server.cookie. domain =
    server.cookie. path =
    server.cookie. comment =
    server.cookie. httpOnly =
    server.cookie. secure =
    server.cookie. maxAge =
    server. ssl. Enabled =
    server.ssl. clientAuth =
    server.ssl. ciphers =
    server.ssl. enabledProtocols =
    server.ssl. keyAlias =
    server.ssl. keyPassword =
    server.ssl. keyStore =
    server.ssl. keyStorePassword =
    server.ssl. keyStoreType =
    server.ssl. keyStoreProvider =
    server.ssl. trustStore =
    server.ssl. trustStorePassword =
    server.ssl. trustStoreType =
    server.ssl. trustStoreProvider =
    server.ssl. protocol =
    server.compression. enabled =
    server.compression.mimeTypes =
    server.compression.excludedUserAgents =
    server.compression.minResponseSize =
    server. jspServlet. className =
    server.jspServlet. initParameters =
    server.jspServlet.registered =
    server.tomcat.accesslog.enabled =
    server.tomcat.accesslog.pattern =
    server.tomcat.accesslog.directory =
    server.tomcat.accesslog.prefix =
    server.tomcat.accesslog.suffix =
    server.tomcat.accesslog.rotate =
    server.tomcat.accesslog.renameOnRotate =
    server.tomcat.accesslog.requestAttributesEnabled=
    server.tomcat.accesslog.buffered =
    server.tomcat.internalProxies =
    server.tomcat.protocolHeader =
    server.tomcat.protocolHeaderHttpsValue =
    server.tomcat.portHeader =
    server.tomcat.remoteIpHeader=
    server.tomcat.basedir =
    server.tomcat.backgroundProcessorDelay =
    server.tomcat.maxThreads =
    server.tomcat.minSpareThreads =
    server.tomcat.maxHttpPostSize =
    server.tomcat.maxHttpHeaderSize =
    server.tomcat.redirectContextRoot =
    server.tomcat.uriEncoding =
    server.tomcat.maxConnections =
    server.tomcat.acceptCount =
    server.tomcat.additionalTldSkipPatterns =

    展开全文
  • 记一次线上服务器宕机 springboot tomcat 今天点网站发现请求不了了,到服务器查看,发现tomcat死了。 查看log 发现 但是项目本地跑,没发现问题。 查看了一下项目,怀疑是定时任务 占用线程池 满 导致内存泄漏 ...

    记一次线上服务器宕机 springboot tomcat

    今天点网站发现请求不了了,到服务器查看,发现tomcat死了。
    查看log
    发现
    在这里插入图片描述
    但是项目本地跑,没发现问题。
    查看了一下项目,怀疑是定时任务 占用线程池 满 导致内存泄漏
    具体看一下定时任务中有没有
    暂时重启服务器让服务跑通

    展开全文
  • 更改SpringBoot TomCat运行方式

    万次阅读 2018-08-11 10:40:58
    1. 为什么要更改SpringBoot运行方式? Tomcat Connector(连接器)有三种运行模式:bio nio apr bio(blocking I/O) 即阻塞式I/O操作,表示Tomcat使用的是传统的Java I/O操作(即java.io包及其子包),是基于JAVA的...
  • springboot tomcat优化

    千次阅读 2019-08-20 20:14:58
    tomcat官网 https://tomcat.apache.org/tomcat-8.5-doc/config/http.html HTTP连接器,组件的特定实例侦听服务器上特定TCP端口号上的连接。 每个传入请求在该请求期间都需要一个线程。如果接收到的并发请求多于当前...
  • springboot tomcat 高并发优化

    千次阅读 2020-10-10 09:49:21
    通过Tomcat配置改善SpringBoot项目并发线程数
  • springBoot tomcat启动

    千次阅读 2016-09-21 18:23:15
    Application configuration class: @ComponentScan(basePackages = "test") @EnableAutoConfiguration public class ServletInitializer extends SpringBootServletInitializer { @Override protected Spring
  • Springboot tomcat-embed-jasper依赖说明

    万次阅读 2018-05-30 11:57:07
    使用过Springboot的同学都知道其已内置tomcat(spring-boot-starter-web),无需打war包,打成jar包直接运行。最近学习使用Springboot发现项目中的pom文件引入了tomcat-embed-jasper(对jsp的支持的依赖)且scope为...
  • springBoot tomcat 不定时报404

    千次阅读 2017-06-13 17:40:33
    用的是springBoot内嵌的tomcat,然后会发现页面隔一段时间就报404 错误代码如下 17:01:06.322 [http-nio-8080-exec-4] WARN o.s.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/...
  • IDEA Springboot Tomcat热部署

    千次阅读 2017-04-17 20:40:54
    修改Tomcat包部署方式,IDEA运行Tomcat时有两种打包方式,一种是生成war,一种是生成文件夹,我们选择生成文件夹的方式,打开run/debug configurations进行修改 这种方式编译后会在项目的target目录下生成对应...
  • 首先看看springboot内置的tomcat,该如何配置这两个参数 # 在配置文件中添加如下内容 # tomcat最大线程数,默认为200 server.tomcat.max-threads=200 # tomcat最大连接数,默认为10000(网上的说法) server....
  • 为什么springboot tomcat端口默认是8080

    千次阅读 2019-10-19 00:16:54
    spring boot 在 EmbeddedServletContainerAutoConfiguration.java 中进行了 Servlet 容器 的相关配置,你可以根据该类下的 EmbeddedTomcat 方法一步一步的向上追溯。最后在 ...
  •       #页面压缩 server.compression.enabled=true server.compression.mime-types=application/json,application/xml,text/html,text/xml,text/plain server.compression.min-response-size=100
  • springboot tomcat设置特殊字符入参"|

    千次阅读 2018-01-30 14:42:56
    public static void main(String[] args) { SpringApplication.run(Starter.class, ... //指定jre系统属性,允许 特殊符号 | 做入参 详情见 tomcat HttpParser类 System.setProperty("tomcat.util.http.parser.Htt
  • 1. server.tomcat.accept-count=100 连接数达到最大时,允许排队的最大连接数(Maximum queue length for incoming connection requests when all possible request processing threads are in use.),默认为100; ...
  • at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) [tomcat-embed-websocket-8.5.34.jar:8.5.34] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter...
  • springboot项目启动中不同的是 @SpringBootApplication(exclude = DataSourceAutoConfiguration.class) @ComponentScan(basePackages = {"com.offerking.oktoutiao_admin"}) @MapperScan(basePackages =...
  • SpringBoot内置Tomcat配置

    万次阅读 2018-12-14 14:38:27
    文章目录SpringBoot内置Tomcat配置2.内置配置生效流程3.直接用类来配置 SpringBoot内置Tomcat配置 ####1. 常用配置 server: # 服务http端口 port: 8080 # tomcat配置 tomcat: # 最大线程数 max-threads: 6 # ...
  • SpringBoot整合Tomcat

    2019-05-29 20:04:27
    1、概念:SpringBoot 整合 Tomcat 2、背景  SpringBoot 本身支持有两类的 WEB 容器:默认的 Tomcat、Jetty,那么现在如果从实际的角度来看,在 SpringBoot 运行的时候 即使没有 WEB 容器,那么也可以采用自定义的...
  • SpringBoot修改tomcat配置

    千次阅读 2019-03-08 10:45:47
    SpringBoot修改tomcat相关配置 方式一:修改和server有关的配置(ServerProperties【也是EmbeddedServletContainerCustomizer】); //通用的Servlet容器设置 server.xxx //Tomcat的设置 server.tomcat.xxx ``` ...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 88,201
精华内容 35,280
关键字:

springboottomcat

spring 订阅