There is an initialization function on servlet level, init() method. It is called once, on first servlet use.
Is there an “init()” method on war level. The one that would be called once, on loading war or before first servlet is activated. Something like “main” in normal Java program, for initializing.
Yes. What you’re looking for is a
ServletContextListener. You may have several of those, and they’re called when the app is initialized and when it’s destroyed.