Skip to content

Commit 5307a87

Browse files
committed
Polishing
Issue: SPR-11357
1 parent 87179b0 commit 5307a87

File tree

4 files changed

+34
-35
lines changed

4 files changed

+34
-35
lines changed

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 the original author or authors.
2+
* Copyright 2002-2014 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.
@@ -25,12 +25,12 @@
2525
import org.springframework.web.WebApplicationInitializer;
2626

2727
/**
28-
* Convenient base class for {@link WebApplicationInitializer} implementations that
29-
* register a {@link ContextLoaderListener} in the servlet context.
28+
* Convenient base class for {@link WebApplicationInitializer} implementations
29+
* that register a {@link ContextLoaderListener} in the servlet context.
3030
*
31-
* <p>The only method required to be implemented by subclasses is {@link
32-
* #createRootApplicationContext()}, which gets invoked from {@link
33-
* #registerContextLoaderListener(javax.servlet.ServletContext)}.
31+
* <p>The only method required to be implemented by subclasses is
32+
* {@link #createRootApplicationContext()}, which gets invoked from
33+
* {@link #registerContextLoaderListener(ServletContext)}.
3434
*
3535
* @author Arjen Poutsma
3636
* @author Chris Beams
@@ -64,7 +64,7 @@ protected void registerContextLoaderListener(ServletContext servletContext) {
6464
}
6565

6666
/**
67-
* Create the "root" application context to be provided to the
67+
* Create the "<strong>root</strong>" application context to be provided to the
6868
* {@code ContextLoaderListener}.
6969
* <p>The returned context is delegated to
7070
* {@link ContextLoaderListener#ContextLoaderListener(WebApplicationContext)} and will

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@
2121
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
2222

2323
/**
24-
* Base class for {@link org.springframework.web.WebApplicationInitializer
25-
* WebApplicationInitializer} implementations that register a {@link
26-
* org.springframework.web.servlet.DispatcherServlet DispatcherServlet}
27-
* configured with annotated classes, e.g. Spring's {@link
28-
* org.springframework.context.annotation.Configuration @Configuration} classes.
24+
* Base class for {@link org.springframework.web.WebApplicationInitializer}
25+
* implementations that register a
26+
* {@link org.springframework.web.servlet.DispatcherServlet DispatcherServlet}
27+
* configured with annotated classes, e.g. Spring's
28+
* {@link org.springframework.context.annotation.Configuration @Configuration} classes.
2929
*
3030
* <p>Concrete implementations are required to implement {@link #getRootConfigClasses()}
31-
* and {@link #getServletConfigClasses()} as well as {@link #getServletMappings()}. Further
32-
* template and customization methods are provided by {@link
33-
* AbstractDispatcherServletInitializer}.
31+
* and {@link #getServletConfigClasses()} as well as {@link #getServletMappings()}.
32+
* Further template and customization methods are provided by
33+
* {@link AbstractDispatcherServletInitializer}.
3434
*
3535
* @author Arjen Poutsma
3636
* @author Chris Beams
@@ -88,7 +88,7 @@ protected WebApplicationContext createServletApplicationContext() {
8888
* provided to the {@linkplain #createServletApplicationContext() dispatcher servlet
8989
* application context}.
9090
* @return the configuration classes for the dispatcher servlet application context
91-
* (may not be empty or {@code null}).
91+
* (may not be empty or {@code null})
9292
*/
9393
protected abstract Class<?>[] getServletConfigClasses();
9494

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

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 the original author or authors.
2+
* Copyright 2002-2014 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.
@@ -33,14 +33,13 @@
3333
import org.springframework.web.servlet.DispatcherServlet;
3434

3535
/**
36-
* Base class for {@link org.springframework.web.WebApplicationInitializer
37-
* WebApplicationInitializer} implementations that register a {@link DispatcherServlet} in
38-
* the servlet context.
36+
* Base class for {@link org.springframework.web.WebApplicationInitializer}
37+
* implementations that register a {@link DispatcherServlet} in the servlet context.
3938
*
40-
* <p>Concrete implementations are required to implement {@link
41-
* #createServletApplicationContext()}, as well as {@link #getServletMappings()}, both of
42-
* which gets invoked from {@link #registerDispatcherServlet(ServletContext)}. Further
43-
* customization can be achieved by overriding
39+
* <p>Concrete implementations are required to implement
40+
* {@link #createServletApplicationContext()}, as well as {@link #getServletMappings()},
41+
* both of which get invoked from {@link #registerDispatcherServlet(ServletContext)}.
42+
* Further customization can be achieved by overriding
4443
* {@link #customizeRegistration(ServletRegistration.Dynamic)}.
4544
*
4645
* <p>Because this class extends from {@link AbstractContextLoaderInitializer}, concrete
@@ -80,10 +79,10 @@ public void onStartup(ServletContext servletContext) throws ServletException {
8079
* @param servletContext the context to register the servlet against
8180
*/
8281
protected void registerDispatcherServlet(ServletContext servletContext) {
83-
String servletName = this.getServletName();
82+
String servletName = getServletName();
8483
Assert.hasLength(servletName, "getServletName() may not return empty or null");
8584

86-
WebApplicationContext servletAppContext = this.createServletApplicationContext();
85+
WebApplicationContext servletAppContext = createServletApplicationContext();
8786
Assert.notNull(servletAppContext,
8887
"createServletApplicationContext() did not return an application " +
8988
"context for servlet [" + servletName + "]");
@@ -105,7 +104,7 @@ protected void registerDispatcherServlet(ServletContext servletContext) {
105104
}
106105
}
107106

108-
this.customizeRegistration(registration);
107+
customizeRegistration(registration);
109108
}
110109

111110
/**
@@ -120,22 +119,22 @@ protected String getServletName() {
120119
/**
121120
* Create a servlet application context to be provided to the {@code DispatcherServlet}.
122121
* <p>The returned context is delegated to Spring's
123-
* {@link DispatcherServlet#DispatcherServlet(WebApplicationContext)} As such, it
124-
* typically contains controllers, view resolvers, locale resolvers, and other
122+
* {@link DispatcherServlet#DispatcherServlet(WebApplicationContext)}. As such,
123+
* it typically contains controllers, view resolvers, locale resolvers, and other
125124
* web-related beans.
126125
* @see #registerDispatcherServlet(ServletContext)
127126
*/
128127
protected abstract WebApplicationContext createServletApplicationContext();
129128

130129
/**
131-
* Specify the servlet mapping(s) for the {@code DispatcherServlet}, e.g. '/', '/app', etc.
130+
* Specify the servlet mapping(s) for the {@code DispatcherServlet} &mdash;
131+
* for example {@code "/"}, {@code "/app"}, etc.
132132
* @see #registerDispatcherServlet(ServletContext)
133133
*/
134134
protected abstract String[] getServletMappings();
135135

136136
/**
137-
* Specify filters to add and also map to the {@code DispatcherServlet}.
138-
*
137+
* Specify filters to add and map to the {@code DispatcherServlet}.
139138
* @return an array of filters or {@code null}
140139
* @see #registerServletFilter(ServletContext, Filter)
141140
*/
@@ -154,9 +153,8 @@ protected Filter[] getServletFilters() {
154153
* {@code FORWARD}, {@code INCLUDE}, and conditionally {@code ASYNC} depending
155154
* on the return value of {@link #isAsyncSupported() asyncSupported}
156155
* </ul>
157-
* <p>If the above defaults are not suitable or insufficient, register
158-
* filters directly with the {@code ServletContext}.
159-
*
156+
* <p>If the above defaults are not suitable or insufficient, override this
157+
* method and register filters directly with the {@code ServletContext}.
160158
* @param servletContext the servlet context to register filters with
161159
* @param filter the filter to be registered
162160
* @return the filter registration

spring-webmvc/src/test/java/org/springframework/web/servlet/support/AnnotationConfigDispatcherServletInitializerTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ protected Filter[] getServletFilters() {
179179

180180
private class MyMockServletContext extends MockServletContext {
181181

182+
@Override
182183
public <T extends EventListener> void addListener(T t) {
183184
if (t instanceof ServletContextListener) {
184185
((ServletContextListener) t).contextInitialized(new ServletContextEvent(this));

0 commit comments

Comments
 (0)