0

I have a tomcat webapp which has a dependency on another application (which will mostly not have started up when tomcat starts), so my initialization fails.

I want to know if there is a way to skip the initialization of my webapp at tomcat startup and initialize it only when my servlet gets a request.

4

3 回答 3

1

load-on-startup标签有助于 servlet预初始化只需删除标签,您将获得所需的延迟加载

于 2013-09-25T12:03:19.870 回答
1

默认情况下servlet,除非您在web.xmlusingload-on-startup参数中另有说明,否则您将仅在第一次调用时对其进行初始化。

于 2013-09-25T12:02:07.770 回答
0

不要设置load-on-startup。或者,您可以将依赖 servlet 设置load-on-startup为比它所依赖的 servlet 更高的值,以确保它们将按顺序启动。

于 2013-09-25T12:00:23.883 回答