load-on-startup含义

    技术2025-01-13  12

    load-on-startup含义

    这个标签的含义是指,容器启动时加载这个servlet的顺序,正常的取值范围是:负数,0-5,如果是负数或者没有这个标签,则容器在启动时不自动加载这个servlet,如果是0-5,则按照顺序加载这个servlet,执行初始化方法init()。数字是0-5,加载顺序也是0-5。

          但是发现glassfish2.1中0的启动时也不加载。

    下面是文档说明: 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.

    最新回复(0)