在servlet的配置当中,<load-on-startup>5</load-on-startup>的含义是:

标记容器是否在启动的时候就加载这个servlet。

当值为0或者大于0时,表示容器在应用启动时就加载这个servlet;

当是一个负数时或者没有指定时,则指示容器在该servlet被选择时才加载。

正数的值越小,启动该servlet的优先级越高。

Servlet   specification:

The   load-on-startup   element  
indicates   that   this   servlet   should   be   loaded  
(instantiated   and   have   its   init()   called)   on   the  
startup   of   the   web   application.   The   optional   contents  
of   these   element   must   be   an   integer   indicating   the  
order   in   which   the   servlet   should   be   loaded.   If   the  
value   is   a   negative   integer,   or   the   element   is   not  
present,   the   container   is   free   to   load   the   servlet  
whenever   it   chooses.     If   the   value   is   a   positive  
integer   or   0,   the   container   must   load   and   initialize  
the   servlet   as   the   application   is   deployed.   The  
container   must   guarantee   that   servlets   marked   with   lower  
integers   are   loaded   before   servlets   marked   with   higher  
integers.   The   container   may   choose   the   order   of  
loading   of   servlets   with   the   same   load-on-start-up   value.

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/enjoyo/archive/2007/08/27/1761033.aspx

EG:

<servlet>
    <servlet-name>LogIniter</servlet-name>
    <servlet-class>com.init.LogIniter</servlet-class>
    <init-param>
      <param-name>log4j</param-name>
      <param-value>/WEB-INF/log4j.properties</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>

<servlet>
    <servlet-name>DicDataIniter</servlet-name>
    <servlet-class>com.init.DicDataIniter</servlet-class>
    <load-on-startup>2</load-on-startup>
  </servlet>

<servlet-mapping>
    <servlet-name>LogIniter</servlet-name>
    <url-pattern>/LogIniter</url-pattern>
  </servlet-mapping>

<servlet-mapping>
    <servlet-name>DicDataIniter</servlet-name>
    <url-pattern>/DicDataIniter</url-pattern>
  </servlet-mapping>

[转]Servlet的load-on-startup的更多相关文章

  1. Spring boot 全局配置文件application.properties

    #更改Tomcat端口号 server.port=8090 #修改进入DispatcherServlet的规则为:*.htmlserver.servlet-path=*.html#这里要注意高版本的s ...

  2. SpringBoot 全配置(推荐收藏)

    # =================================================================== # COMMON SPRING BOOT PROPERTIE ...

  3. SpringBoot 之 MVC

    SpringBoot MVC 和静态资源 首先,我们一定要搞清楚,mvc 配置和 static 配置的联系和区别. mvc 配置其实就是给 spring mvc 框架用的, 具体来说, 比如 @Req ...

  4. sprint boot 配置

    来源:https://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#howto-configure-to ...

  5. spring boot的默认配置

    # BANNER banner.charset=UTF- # Banner file encoding. banner.location=classpath:banner.txt # Banner f ...

  6. Servlet 工作原理解析

    转自:http://www.ibm.com/developerworks/cn/java/j-lo-servlet/ Web 技术成为当今主流的互联网 Web 应用技术之一,而 Servlet 是 J ...

  7. JavaWeb总结--Servlet 工作原理解析

    从 Servlet 容器说起 要介绍 Servlet 必须要先把 Servlet 容器说清楚,Servlet 与 Servlet 容器的关系有点像枪和子弹的关系,枪是为子弹而生,而子弹又让枪有了杀伤力 ...

  8. Servlet容器的启动过程

    [http://book.51cto.com/art/201408/448854.htm]   Tomcat的启动逻辑是基于观察者模式设计的,所有的容器都会继承Lifecycle接口,它管理着容器的整 ...

  9. [转]Servlet 工作原理解析

    Web 技术成为当今主流的互联网 Web 应用技术之一,而 Servlet 是 Java Web 技术的核心基础.因而掌握 Servlet 的工作原理是成为一名合格的 Java Web 技术开发人员的 ...

  10. Servlet 工作原理解析--转载

    原文:http://www.ibm.com/developerworks/cn/java/j-lo-servlet/index.html?ca=drs- Web 技术成为当今主流的互联网 Web 应用 ...

随机推荐

  1. Caffe学习笔记3

    Caffe学习笔记3 本文为原创作品,未经本人同意,禁止转载,禁止用于商业用途!本人对博客使用拥有最终解释权 欢迎关注我的博客:http://blog.csdn.net/hit2015spring和h ...

  2. 使用makecontext实现用户线程【转】

    转自:http://blog.csdn.net/cyberlabs/article/details/6920138 使用makecontext实现用户线程 现代Unix系统都在ucontext.h中提 ...

  3. mount/umount命令【转】

    转自:http://www.cnblogs.com/qq78292959/archive/2012/03/06/2382334.html 如果想在运行的Linux下访问其它文件系统中的资源的话,就要用 ...

  4. perl_nc.pl

    #!/usr/bin/perl use strict; use IO::Socket; use IO::Select; use Getopt::Std; my %option;getopts('lp: ...

  5. 一文看懂IC芯片生产流程:从设计到制造与封装

    http://blog.csdn.net/yazhouren/article/details/50810114 芯片制造的过程就如同用乐高盖房子一样,先有晶圆作为地基,再层层往上叠的芯片制造流程后,就 ...

  6. Vim的分屏功能(转)

    注:本文属于转载,源地址:http://blog.csdn.net/ithomer/article/details/6035627(博主很牛,欢迎关注) 本篇文章主要教你如何使用 Vim 分屏功能 分 ...

  7. JavaScript中常用的BOM属性

    window 窗口 window.open():打开窗口.返回一个指向新窗口的引用. window.close():关闭窗口. window.resizeTo():调整窗口尺寸到指定值 window. ...

  8. SPOJ 375

    默默一看提交时间 -- 这是我以前的代码风格-- #include <cstdio> #include <cstring> #include <vector> #i ...

  9. django渲染模板时跟vue使用的{{ }}冲突解决方法

    var vm = new Vue({ el: '#app', // 分割符: 修改vue中显示数据的语法, 防止与django冲突 delimiters: ['[[', ']]'], data: { ...

  10. AC日记——旅游 bzoj 2157

    2157 思路: LCT: 代码: #include <bits/stdc++.h> using namespace std; #define maxn 400005 #define IN ...