package com.lovecoding.servlet01;

import javax.servlet.*;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * ClassName: MyServlet
 * Package: com.lovecoding.servlet01
 * Description:
 *
 * @Author 爱扣钉-陈晨
 * @Create 2023/5/31 15:50
 * @Version 1.0
 */
/*
loadOnStartup 启动的时候就会 先创建 servlet 执行init
 */

@WebServlet(name = "LifeServlet" , value = "/life" ,loadOnStartup = 1)
public class LifeServlet implements Servlet {

    public LifeServlet() {
        System.out.println("LifeServlet");
    }

    @Override
    public void init(ServletConfig servletConfig) throws ServletException {
        System.out.println("init 55555555555");
    }

    @Override
    public void service(ServletRequest servletRequest, ServletResponse servletResponse) throws ServletException, IOException {
        System.out.println("service 66666666666");
    }

    @Override
    public void destroy() {
        System.out.println("destroy 7777777777777777");
    }

    @Override
    public String getServletInfo() {
        return null;
    }

    @Override
    public ServletConfig getServletConfig() {
        return null;
    }

}
