如何优化移动网站以提升宁波地区的搜索引擎排名?

摘要:做移动网站优化优,宁波seo整体优化公司,网站不支持下载的视频怎么下载,建站公司如何月入十万58、嵌入式Servlet容器切换web服务器与定制化 # 嵌入式Servlet容器切换与定制化 ## 切换Web服务器 ### 1. 原理 Spr
做移动网站优化优,宁波seo整体优化公司,网站不支持下载的视频怎么下载,建站公司如何月入十万58、嵌入式Servlet容器切换web服务器与定制化 # 嵌入式Servlet容器切换与定制化 ## 切换Web服务器 ### 1. 原理 Spring Boot默认使用Tomcat作为嵌入式Servlet容器。切换其他容器#xff08;如Jetty或Undertow#xff09;的原理如下#xff1a; #### 自动配置类 - ServletWeb… 58、嵌入式Servlet容器切换web服务器与定制化 # 嵌入式Servlet容器切换与定制化 ## 切换Web服务器 ### 1. 原理 Spring Boot默认使用Tomcat作为嵌入式Servlet容器。切换其他容器如Jetty或Undertow的原理如下 #### 自动配置类 - ServletWebServerFactoryAutoConfiguration是关键的自动配置类负责创建ServletWebServerFactory。 #### 条件判断 - 根据项目中引入的依赖自动配置类会判断系统中存在哪些Web服务器相关的类。 #### 工厂类 - Spring Boot提供了多个ServletWebServerFactory实现 - TomcatServletWebServerFactory - JettyServletWebServerFactory - UndertowServletWebServerFactory - 根据条件判断选择相应的工厂类创建对应的Web服务器。 ### 2. 切换步骤 #### 排除默认Tomcat依赖 在pom.xml中排除spring-boot-starter-tomcat xml dependency groupIdorg.springframework.boot/groupId artifactIdspring-boot-starter-web/artifactId exclusions exclusion groupIdorg.springframework.boot/groupId artifactIdspring-boot-starter-tomcat/artifactId /exclusion /exclusions /dependency #### 添加目标服务器依赖 - **切换为Jetty** xml dependency groupIdorg.springframework.boot/groupId artifactIdspring-boot-starter-jetty/artifactId /dependency - **切换为Undertow** xml dependency groupIdorg.springframework.boot/groupId artifactIdspring-boot-starter-undertow/artifactId /dependency ### 3. 示例 #### 切换为Jetty xml dependency groupIdorg.springframework.boot/groupId artifactIdspring-boot-starter-web/artifactId exclusions !-- 排除Tomcat -- exclusion groupIdorg.springframework.boot/groupId artifactIdspring-boot-starter-tomcat/artifactId /exclusion /exclusions /dependency !-- 引入Jetty -- dependency groupIdorg.springframework.boot/groupId artifactIdspring-boot-starter-jetty/artifactId /dependency 重新启动应用Spring Boot将使用Jetty作为嵌入式Servlet容器。
阅读全文