|
@@ -10,8 +10,11 @@ import javax.servlet.ServletContextListener;
|
10
|
10
|
public class ContextLoadListener implements ServletContextListener {
|
11
|
11
|
public void contextInitialized(ServletContextEvent sce) {
|
12
|
12
|
// ServletContextListener.super.contextInitialized(sce);
|
13
|
|
- AnnotationConfigApplicationContext annotationConfigApplicationContext = new AnnotationConfigApplicationContext(SpringConfig.class);
|
14
|
13
|
ServletContext servletContext = sce.getServletContext();
|
|
14
|
+ // 获取web.xml中默认设置参数
|
|
15
|
+ String initParameter = servletContext.getInitParameter("testName");
|
|
16
|
+ System.out.println(initParameter);
|
|
17
|
+ AnnotationConfigApplicationContext annotationConfigApplicationContext = new AnnotationConfigApplicationContext(SpringConfig.class);
|
15
|
18
|
servletContext.setAttribute("app",annotationConfigApplicationContext);
|
16
|
19
|
System.out.println("servletContextLoader");
|
17
|
20
|
}
|