프로그래머스 백엔드 데브코스 29일차
spring boot part3
tomcat - artifacts
tomcat - facets
web.xml
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<servlet>
<servlet-name>test</servlet-name>
<servlet-class>org.prgrms.kdt.servlet.TestServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>test</servlet-name>
<url-pattern>/test</url-pattern>
</servlet-mapping>
</web-app>
@WebServlet
@WebServlet(value = "/*", loadOnStartup = 1)
public class TestServlet extends HttpServlet { ... }
WebApplicationInitializer
public class TestWebApplicationInitializer implements WebApplicationInitializer {
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
var servletRegistration = servletContext.addServlet("test", new TestServlet());
servletRegistration.addMapping("/*");
servletRegistration.setLoadOnStartup(1);
}
}