Skip to content

Commit 341d645

Browse files
committed
Polishing
Issue: SPR-11357
1 parent 9845d9e commit 341d645

File tree

2 files changed

+12
-16
lines changed

2 files changed

+12
-16
lines changed

spring-web/src/main/java/org/springframework/web/context/AbstractContextLoaderInitializer.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2013 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.
@@ -38,11 +38,12 @@
3838
*/
3939
public abstract class AbstractContextLoaderInitializer implements WebApplicationInitializer {
4040

41-
/** Logger available to subclasses. */
41+
/** Logger available to subclasses */
4242
protected final Log logger = LogFactory.getLog(getClass());
4343

44+
4445
public void onStartup(ServletContext servletContext) throws ServletException {
45-
this.registerContextLoaderListener(servletContext);
46+
registerContextLoaderListener(servletContext);
4647
}
4748

4849
/**
@@ -52,7 +53,7 @@ public void onStartup(ServletContext servletContext) throws ServletException {
5253
* @param servletContext the servlet context to register the listener against
5354
*/
5455
protected void registerContextLoaderListener(ServletContext servletContext) {
55-
WebApplicationContext rootAppContext = this.createRootApplicationContext();
56+
WebApplicationContext rootAppContext = createRootApplicationContext();
5657
if (rootAppContext != null) {
5758
servletContext.addListener(new ContextLoaderListener(rootAppContext));
5859
}

spring-webmvc/src/main/java/org/springframework/web/servlet/support/AbstractDispatcherServletInitializer.java

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2013 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.
@@ -17,7 +17,6 @@
1717
package org.springframework.web.servlet.support;
1818

1919
import java.util.EnumSet;
20-
2120
import javax.servlet.DispatcherType;
2221
import javax.servlet.Filter;
2322
import javax.servlet.FilterRegistration;
@@ -55,19 +54,19 @@
5554
* @author Rossen Stoyanchev
5655
* @since 3.2
5756
*/
58-
public abstract class AbstractDispatcherServletInitializer
59-
extends AbstractContextLoaderInitializer {
57+
public abstract class AbstractDispatcherServletInitializer extends AbstractContextLoaderInitializer {
6058

6159
/**
6260
* The default servlet name. Can be customized by overriding {@link #getServletName}.
6361
*/
6462
public static final String DEFAULT_SERVLET_NAME = "dispatcher";
6563

64+
6665
@Override
6766
public void onStartup(ServletContext servletContext) throws ServletException {
6867
super.onStartup(servletContext);
6968

70-
this.registerDispatcherServlet(servletContext);
69+
registerDispatcherServlet(servletContext);
7170
}
7271

7372
/**
@@ -82,19 +81,15 @@ public void onStartup(ServletContext servletContext) throws ServletException {
8281
*/
8382
protected void registerDispatcherServlet(ServletContext servletContext) {
8483
String servletName = this.getServletName();
85-
Assert.hasLength(servletName,
86-
"getServletName() may not return empty or null");
84+
Assert.hasLength(servletName, "getServletName() may not return empty or null");
8785

8886
WebApplicationContext servletAppContext = this.createServletApplicationContext();
8987
Assert.notNull(servletAppContext,
9088
"createServletApplicationContext() did not return an application " +
91-
"context for servlet [" + servletName + "]");
89+
"context for servlet [" + servletName + "]");
9290

9391
DispatcherServlet dispatcherServlet = new DispatcherServlet(servletAppContext);
94-
95-
ServletRegistration.Dynamic registration =
96-
servletContext.addServlet(servletName, dispatcherServlet);
97-
92+
ServletRegistration.Dynamic registration = servletContext.addServlet(servletName, dispatcherServlet);
9893
Assert.notNull(registration,
9994
"Failed to register servlet with name '" + servletName + "'." +
10095
"Check if there is another servlet registered under the same name.");

0 commit comments

Comments
 (0)