context
load-on-startup
1.load-on-startup 元素标记容器是否应该在web应用程序启动的时候就加载这个servlet,(实例化并调用其init()方法)。
2.它的值必须是一个整数,表示servlet被加载的先后顺序。
3.如果该元素的值为负数或者没有设置,则容器会当Servlet被请求时再加载。
4.如果值为正整数或者0时,表示容器在应用启动时就加载并初始化这个servlet,值越小,servlet的优先级越高,就越先被加载。值相同时,容器就会自己选择顺序来加载。
<?xml version="1.0" encoding="UTF-8"?> <web-app id="MS_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <display-name>Archetype Created Web Application</display-name> <context-param> <param-name>webAppRootKey</param-name> <param-value>mc.root</param-value> </context-param> <context-param> <param-name>logbackConfigLocation</param-name> <param-value>/WEB-INF/classes/logback.xml</param-value> </context-param> <context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath*:spring-config/*.xml</param-value> </context-param> <listener> <listener-class> ch.qos.logback.ext.spring.web.LogbackConfigListener </listener-class> </listener> <listener> <listener-class> org.springframework.web.context.ContextLoaderListener </listener-class> </listener> <listener> <listener-class> org.springframework.web.context.request.RequestContextListener </listener-class> </listener> <filter> <filter-name>customLogFilter</filter-name> <filter-class>com.xx.log.CustomLogFilter</filter-class> </filter> <filter-mapping> <filter-name>customLogFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <filter> <filter-name>springSessionRepositoryFilter</filter-name> <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> </filter> <filter-mapping> <filter-name>springSessionRepositoryFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <!-- struts配置 begin --> <filter> <filter-name>struts2</filter-name> <filter-class>com.xx.util.ExtendStrutsFilter</filter-class> </filter> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <!-- <filter> <filter-name>jsonp</filter-name> <filter-class>com.xx.util.JerseyJsonpFilter</filter-class> </filter> <filter-mapping> <filter-name>jsonp</filter-name> <url-pattern>/rest/*</url-pattern> </filter-mapping> <servlet> <servlet-name>JerseyServlet</servlet-name> <servlet-class>com.sun.jersey.spi.spring.container.servlet.SpringServlet</servlet-class> <init-param> <param-name>com.sun.jersey.config.property.packages</param-name> <param-value>com.xx.inf</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>JerseyServlet</servlet-name> <url-pattern>/rest/*</url-pattern> </servlet-mapping> --> <servlet> <description>initActorSystem</description> <display-name>initActorSystem</display-name> <servlet-name>initActorSystem</servlet-name> <servlet-class>com.xx.akka.InitActorSystem</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <filter> <filter-name>sessionFilter</filter-name> <filter-class>com.xx.util.SessionInterceptor</filter-class> </filter> <filter-mapping> <filter-name>sessionFilter</filter-name> <url-pattern>*.jsp</url-pattern> </filter-mapping> <filter> <filter-name>operateFilter</filter-name> <filter-class>com.xx.util.OperateInterceptor</filter-class> </filter> <filter-mapping> <filter-name>operateFilter</filter-name> <url-pattern>*.jsp</url-pattern> </filter-mapping> <filter> <filter-name>checkRefererFilter</filter-name> <filter-class>com.xx.util.CheckRefererInterceptor</filter-class> </filter> <filter-mapping> <filter-name>checkRefererFilter</filter-name> <url-pattern>*.jsp</url-pattern> </filter-mapping> <!-- <error-page> <error-code>404</error-code> <location>/error.jsp</location> </error-page> --> <welcome-file-list> <welcome-file>login.jsp</welcome-file> </welcome-file-list> </web-app>