启动的时候,发现Tomcat7.0.50用了大量的时间去加载mime,而且每次执行一个action请求,它就疯狂的再来加载mime,服务器加载日志Initializing Spring root WebApplicationContext定在这里,打印信息如下:
[code="java"]
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="2.4"
metadata-complete="true">
Struts 2 - Maven Archetype - Starter
contextConfigLocation
classpath*:applicationContext*.xml
struts2-prepare
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter
false
sitemesh
com.opensymphony.module.sitemesh.filter.PageFilter
false
struts2-execute
org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter
false
struts2-prepare
/*
sitemesh
/*
struts2-execute
/*
org.springframework.web.context.ContextLoaderListener
jsp
org.apache.jasper.servlet.JspServlet
fork
false
xpoweredBy
false
classdebuginfo
true
3
default
org.apache.catalina.servlets.DefaultServlet
debug
0
listings
false
1
jsp
.jsp
jsp
.jspx
default
/
30
fh7
image/x-freehand
fh5
image/x-freehand
...这里省略N多的mime加载
index.jsp
default.jsp
index.html
[/code]
我只部署了一个项目,我想不明白这个mime加载时设置在哪里的,我有什么办法避免这个问题。
楼主你好,这类MIME的信息,是配置在tomcat的conf目录下的web.xml文件中,
[code="java"]
<!-- When serving static resources, Tomcat will automatically generate -->
<!-- a "Content-Type" header based on the resource's filename extension, -->
<!-- based on these mappings. Additional mappings can be added here (to -->
<!-- apply to all web applications), or in your own application's web.xml -->
<!-- deployment descriptor. -->
<mime-mapping>
<extension>123</extension>
<mime-type>application/vnd.lotus-1-2-3</mime-type>
</mime-mapping>
<mime-mapping>
<extension>3dml</extension>
<mime-type>text/vnd.in3d.3dml</mime-type>
</mime-mapping>
<mime-mapping>
<extension>3g2</extension>
<mime-type>video/3gpp2</mime-type>
</mime-mapping>
[/code]
这类配置主要用来影响静态资源时生成Content-Type的。所以你看到的都是这里配置的。每个部署在Tomcat中的Java Web应用,其配置最终是WEB-INF/web.xml和tomcat自带的这个web.xml合并起来生成具体的配置信息的。
你可以手动修改它。
[code="java"]
看你的spring配置文件
是否配置在启动时候检查表了,更新表结构之类的
如:
update
[/code]
好像有一个配置文件,配置一个监听器