java容器优化

Web笔记(八):Tomcat优化

2018-10-29  本文已影响18人  I墨雨

1.Tomcat启动速度优化

  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/>
上一篇 下一篇

猜你喜欢

热点阅读