develog

[springboot] spring boot 에서 servlet 등록 본문

카테고리 없음

[springboot] spring boot 에서 servlet 등록

냐옴 2021. 8. 8. 00:03

@ServletComponentScan

import org.springframework.boot.web.servlet.ServletComponentScan;

@ServletComponentScan
@SpringBootApplication
public class ServletApplication {

    public static void main(String[] args) {
        SpringApplication.run(ServletApplication.class, args);
    }

}

@WebServlet

import javax.servlet.annotation.WebServlet;

@WebServlet(name = "helloServlet", urlPatterns = "/hello")
public class HelloServlet extends HttpServlet {

    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {        
        
    }
}
Comments