Skip to content

Commit 0038aaa

Browse files
committed
ContextLoaderListener extends ContextLoader
1 parent 693ae0c commit 0038aaa

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

org.springframework.web/src/main/java/org/springframework/web/context/ContextLoaderListener.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2007 the original author or authors.
2+
* Copyright 2002-2008 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -31,7 +31,7 @@
3131
* @since 17.02.2003
3232
* @see org.springframework.web.util.Log4jConfigListener
3333
*/
34-
public class ContextLoaderListener implements ServletContextListener {
34+
public class ContextLoaderListener extends ContextLoader implements ServletContextListener {
3535

3636
private ContextLoader contextLoader;
3737

@@ -41,21 +41,30 @@ public class ContextLoaderListener implements ServletContextListener {
4141
*/
4242
public void contextInitialized(ServletContextEvent event) {
4343
this.contextLoader = createContextLoader();
44+
if (this.contextLoader == null) {
45+
this.contextLoader = this;
46+
}
4447
this.contextLoader.initWebApplicationContext(event.getServletContext());
4548
}
4649

4750
/**
4851
* Create the ContextLoader to use. Can be overridden in subclasses.
4952
* @return the new ContextLoader
53+
* @deprecated in favor of simply subclassing ContextLoaderListener itself
54+
* (which extends ContextLoader, as of Spring 3.0)
5055
*/
56+
@Deprecated
5157
protected ContextLoader createContextLoader() {
52-
return new ContextLoader();
58+
return null;
5359
}
5460

5561
/**
5662
* Return the ContextLoader used by this listener.
5763
* @return the current ContextLoader
64+
* @deprecated in favor of simply subclassing ContextLoaderListener itself
65+
* (which extends ContextLoader, as of Spring 3.0)
5866
*/
67+
@Deprecated
5968
public ContextLoader getContextLoader() {
6069
return this.contextLoader;
6170
}

org.springframework.web/src/main/java/org/springframework/web/util/Log4jWebConfigurer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ public static void shutdownLogging(ServletContext servletContext) {
183183
*/
184184
private static boolean exposeWebAppRoot(ServletContext servletContext) {
185185
String exposeWebAppRootParam = servletContext.getInitParameter(EXPOSE_WEB_APP_ROOT_PARAM);
186-
return (exposeWebAppRootParam == null || Boolean.valueOf(exposeWebAppRootParam).booleanValue());
186+
return (exposeWebAppRootParam == null || Boolean.valueOf(exposeWebAppRootParam));
187187
}
188188

189189
}

0 commit comments

Comments
 (0)