1
1
/*
2
- * Copyright 2002-2007 the original author or authors.
2
+ * Copyright 2002-2008 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
31
31
* @since 17.02.2003
32
32
* @see org.springframework.web.util.Log4jConfigListener
33
33
*/
34
- public class ContextLoaderListener implements ServletContextListener {
34
+ public class ContextLoaderListener extends ContextLoader implements ServletContextListener {
35
35
36
36
private ContextLoader contextLoader ;
37
37
@@ -41,21 +41,30 @@ public class ContextLoaderListener implements ServletContextListener {
41
41
*/
42
42
public void contextInitialized (ServletContextEvent event ) {
43
43
this .contextLoader = createContextLoader ();
44
+ if (this .contextLoader == null ) {
45
+ this .contextLoader = this ;
46
+ }
44
47
this .contextLoader .initWebApplicationContext (event .getServletContext ());
45
48
}
46
49
47
50
/**
48
51
* Create the ContextLoader to use. Can be overridden in subclasses.
49
52
* @return the new ContextLoader
53
+ * @deprecated in favor of simply subclassing ContextLoaderListener itself
54
+ * (which extends ContextLoader, as of Spring 3.0)
50
55
*/
56
+ @ Deprecated
51
57
protected ContextLoader createContextLoader () {
52
- return new ContextLoader () ;
58
+ return null ;
53
59
}
54
60
55
61
/**
56
62
* Return the ContextLoader used by this listener.
57
63
* @return the current ContextLoader
64
+ * @deprecated in favor of simply subclassing ContextLoaderListener itself
65
+ * (which extends ContextLoader, as of Spring 3.0)
58
66
*/
67
+ @ Deprecated
59
68
public ContextLoader getContextLoader () {
60
69
return this .contextLoader ;
61
70
}
0 commit comments