171114 ServletContextListener - RYUDONGJIN/Memo_wiki GitHub Wiki
- μΉμ΄ν리μΌμ΄μ μ μλͺ μ£ΌκΈ°λ₯Ό κ°μνλ 리μ€ν°.
- 리μ€λμ ν΄λΉ λ©μλκ° μΉ μ΄ν리μΌμ΄μ μ μμκ³Ό μ’ λ£μ νΈμΆ
- contextInitialized() , contextDestroyed()
contextInitialized() -> @PostConstruct -> init() -> doGet()/doPost()/service() -> destroy() -> @PreDestroy -> contextDestroyed()
<listener>
<listener-class>com.javalec.ex.ContextListenerEx</listener-class>
</listener>
@WebListener
public class ContextListenerEx implements ServletContextListener{
public ContextListenerEx() {
}
@Override
public void contextDestroyed(ServletContextEvent arg0) {
System.out.println("contextDestroyed");
}
@Override
public void contextInitialized(ServletContextEvent arg0) {
System.out.println("contextInitialized");
}
}