|
@@ -12,32 +12,31 @@ import javax.servlet.ServletContext;
|
|
|
import javax.servlet.ServletException;
|
|
|
import javax.servlet.ServletRegistration;
|
|
|
|
|
|
-//public class Application implements WebApplicationInitializer {
|
|
|
-//
|
|
|
-// @Override
|
|
|
-// public void onStartup(ServletContext servletContext) throws ServletException {
|
|
|
-// //System.out.println( "我被调用了!!!" );
|
|
|
-//
|
|
|
-//// XmlWebApplicationContext applicationContext = new XmlWebApplicationContext();
|
|
|
-//// applicationContext.setConfigLocation("classpath:spring.xml");
|
|
|
-//
|
|
|
-//
|
|
|
-//
|
|
|
+public class Application implements WebApplicationInitializer {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onStartup(ServletContext servletContext) throws ServletException {
|
|
|
+
|
|
|
+ XmlWebApplicationContext applicationContext = new XmlWebApplicationContext();
|
|
|
+ applicationContext.setConfigLocation("classpath:spring.xml");
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
// AnnotationConfigWebApplicationContext applicationContext =
|
|
|
// new AnnotationConfigWebApplicationContext();
|
|
|
// applicationContext.register( SpringConfig.class );
|
|
|
-//
|
|
|
-// //配置 MVC 配置档
|
|
|
-// //配置 Mybatis配置档
|
|
|
-//
|
|
|
-// DispatcherServlet dispatcherServlet = new DispatcherServlet(applicationContext);
|
|
|
-//
|
|
|
-// ServletRegistration.Dynamic dispatcher =
|
|
|
-// servletContext.addServlet("dispatcher", dispatcherServlet);
|
|
|
-//
|
|
|
-// dispatcher.setLoadOnStartup(1);
|
|
|
-// dispatcher.addMapping("/");
|
|
|
-//
|
|
|
-// }
|
|
|
-//
|
|
|
-//}
|
|
|
+
|
|
|
+ //配置 MVC 配置档
|
|
|
+ //配置 Mybatis配置档
|
|
|
+
|
|
|
+ DispatcherServlet dispatcherServlet = new DispatcherServlet(applicationContext);
|
|
|
+
|
|
|
+ ServletRegistration.Dynamic dispatcher =
|
|
|
+ servletContext.addServlet("dispatcher", dispatcherServlet);
|
|
|
+
|
|
|
+ dispatcher.setLoadOnStartup(1);
|
|
|
+ dispatcher.addMapping("/");
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+}
|