美文网首页java容器优化
Web笔记(八):Tomcat优化

Web笔记(八):Tomcat优化

作者: I墨雨 | 来源:发表于2018-10-29 18:41 被阅读18次

    1.Tomcat启动速度优化

    • 配置tomcat
      在初次配置tomcat时,双击servet,进入配置:


      1.PNG
    • 启动速度优化

    1. 删除webapps下所有自带的web项目(除了ROOT和自己的项目外)
    2. JavaEE版本为3.0及以上,在web.xml里设置<absolute-ordering/>标签,表示不扫描所有jar包:
    <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
                          http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
      version="3.1"
      metadata-complete="false"> <!--设置false表示扫描注解-->
        <absolute-ordering/>
        <display-name>myproject</display-name>
        <welcome-file-list>
            <welcome-file>index.html</welcome-file>
            <welcome-file>index.htm</welcome-file>
            <welcome-file>index.jsp</welcome-file>
            <welcome-file>default.html</welcome-file>
            <welcome-file>default.htm</welcome-file>
            <welcome-file>default.jsp</welcome-file>
        </welcome-file-list>
    </web-app>
    
    1. 在ROOT/WEB-INF/web.xml里也加入<absolute-ordering/>

    相关文章

      网友评论

        本文标题:Web笔记(八):Tomcat优化

        本文链接:https://www.haomeiwen.com/subject/ekyizftx.html