springboot配置servlet

2020-11-18  本文已影响0人  CXY_XZL

1.代码

@Slf4j
@WebServlet("/my")
public class MyServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        log.info("doGet...");
        super.doGet(req, resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        log.info("doPost...");
        super.doPost(req, resp);
    }
}
@ServletComponentScan
@SpringBootApplication
public class SpireApplication {
    public static void main(String[] args) {
        SpringApplication.run(SpireApplication.class, args);
    }
}

2.相关

上一篇 下一篇

猜你喜欢

热点阅读