This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Per my understanding when Servlet Container calls the init method on a servlet instance ...
"The servlet container calls init(ServletConfig) method at most once on a Servlet instance. It is guaranteed to be called before the container delegates a request to the servlet instance. "
In lazy initialization: It is possible that the container may never call the init method. This happens usually when the containers do lazy initialization of the servlet. i.e. they call the init method only upon first request to the servlet.
When lazy initialization of the servlet come to play role? what senerio and how it is done( DD or on code)? Is it covered for Test?
All servlets are lazy loaded, unless the <load-on-startup> tag is specified in the deployment descriptor. In any case, the servlet life cycle is the same, which means that the init method will be invoked by the container.