Detect DispatcherServlets registered via ServletRegistrationBean

Previously, when a DispatcherServlet was registered via a
ServletRegistrationBean, the mappings endpoint did not expose any
information about it as it wasn't detected.

This commit fixes the detection of available DispatcherServlets in the
context so that the mappings endpoint include them all.

Closes gh-13186
This commit is contained in:
Stephane Nicoll
2018-07-10 17:06:36 +02:00
parent dd2b0eb739
commit 3423c5dddb
3 changed files with 122 additions and 28 deletions

View File

@@ -100,14 +100,6 @@ public class ServletRegistrationBean<T extends Servlet>
this.urlMappings.addAll(Arrays.asList(urlMappings));
}
/**
* Returns the servlet being registered.
* @return the servlet
*/
protected T getServlet() {
return this.servlet;
}
/**
* Sets the servlet to be registered.
* @param servlet the servlet
@@ -117,6 +109,15 @@ public class ServletRegistrationBean<T extends Servlet>
this.servlet = servlet;
}
/**
* Return the servlet being registered.
* @return the servlet
* @since 2.0.4
*/
public T getServlet() {
return this.servlet;
}
/**
* Set the URL mappings for the servlet. If not specified the mapping will default to
* '/'. This will replace any previously specified mappings.