given a simple servlet in WEB-INF/web.xml like
<servlet>
<servlet-name>MyServlet</servlet-name>
<servlet-class>app.MyServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
is it possible to override load-on-startup in my local dev environment so that the servlet is only loaded when first requested, without altering MyServlet class?
Altering web.xml is acceptable as long as the default is for the servlet to load when tomcat starts, could this be done with a context-param ?
I’m running tomcat 7.0.29
Without modifying the
web.xml? No you can not (to my knowledge). You can however remove the declaration completely and use the@WebServletannotation, you can then modifyloadOnStartupin the.javafile directly.