Use a class that implements ServletContextListener in your web.xml:
<web-app>
<!-- Usual stuff here -->
<listener>
<listener-class>com.mycompany.MyClass</listener-class>
</listener>
</web-app>
More Related Contents:
- How to connect with Web Api Spotify (in Java)?
- getResourceAsStream() vs FileInputStream
- Socket using in a swing applet
- File path to resource in our war/WEB-INF folder?
- How to properly shutdown java ExecutorService
- Add Bean Programmatically to Spring Web App Context
- What to learn for making Java web applications in Java EE 6? [closed]
- What is the main-stream Java alternative to ASP.NET / PHP
- Servlet Mapping using web.xml
- calling a java servlet from javascript [duplicate]
- Shutting down a computer
- Best Practices to Create and Download a huge ZIP (from several BLOBs) in a WebApp
- Spring – No EntityManager with actual transaction available for current thread – cannot reliably process ‘persist’ call
- Can I turn off the HttpSession in web.xml?
- Java shutdown hook
- Initializing Log4J with Spring?
- How can I share a variable or object between two or more Servlets?
- How do I get a list of all HttpSession objects in a web application?
- Is there a way to run a method/class only on Tomcat/Wildfly/Glassfish startup?
- Best Way to Gracefully Shutdown a Java Command Line Program
- Deploying Springboot to Azure App Service
- How to shutdown an ExecutorService?
- Role/Purpose of ContextLoaderListener in Spring?
- NoClassDefFoundError JsonAutoDetect while parsing JSON object
- Log4j, configuring a Web App to use a relative path
- How to deploy a Java Web Application (.war) on tomcat?
- ExceptionHandler doesn’t work with Throwable
- How to get shutdown hook to execute on a process launched from Eclipse
- Java – Relative path of a file in a java web application
- Maven: Customize web.xml of web-app project