上海切换校区
全国报名热线
15201841284
/** * * @author 上海尚学堂 MR.YongGan.Zhang * 了解更多微信:java8733 */ public class MyWebAppInitializer implements WebApplicationInitializer { @Override public void onStartup(ServletContext servletContext) throws ServletException { System.out.println(" 加载 启动 MyWebAppInitializer "); XmlWebApplicationContext appContext = new XmlWebApplicationContext(); appContext.setConfigLocation("classpath:spring-mvc.xml"); ServletRegistration.Dynamic dispatcher = servletContext.addServlet("dispatcher", new DispatcherServlet(appContext)); dispatcher.setLoadOnStartup(1); dispatcher.addMapping("/"); } } |
<context:component-scan base-package="org.yonggan.web"/> <!-- 开启矩阵变量模式 --> <mvc:annotation-driven /> |