Class DispatcherServletRegistrationBean
- java.lang.Object
- org.springframework.boot.web.servlet.RegistrationBean
- org.springframework.boot.web.servlet.DynamicRegistrationBean<javax.servlet.ServletRegistration.Dynamic>
- org.springframework.boot.web.servlet.ServletRegistrationBean<org.springframework.web.servlet.DispatcherServlet>
- org.springframework.boot.autoconfigure.web.servlet.DispatcherServletRegistrationBean
- All Implemented Interfaces:
DispatcherServletPath
,org.springframework.boot.web.servlet.ServletContextInitializer
,org.springframework.core.Ordered
public class DispatcherServletRegistrationBean extends org.springframework.boot.web.servlet.ServletRegistrationBean<org.springframework.web.servlet.DispatcherServlet> implements DispatcherServletPath
ServletRegistrationBean
for the auto-configuredDispatcherServlet
. Both registers the servlet and exposesDispatcherServletPath
information.- Since:
- 2.0.4
Constructor Summary
Constructors Constructor Description DispatcherServletRegistrationBean(org.springframework.web.servlet.DispatcherServlet servlet, String path)
Create a newDispatcherServletRegistrationBean
instance for the given servlet and path.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addUrlMappings(String... urlMappings)
String
getPath()
Returns the configured path of the dispatcher servlet.void
setUrlMappings(Collection<String> urlMappings)
Methods inherited from class org.springframework.boot.web.servlet.ServletRegistrationBean
addRegistration, configure, getDescription, getMultipartConfig, getServlet, getServletName, getUrlMappings, setLoadOnStartup, setMultipartConfig, setServlet, toString
Methods inherited from class org.springframework.boot.web.servlet.DynamicRegistrationBean
addInitParameter, getInitParameters, getOrDeduceName, isAsyncSupported, register, setAsyncSupported, setInitParameters, setName
Methods inherited from class org.springframework.boot.web.servlet.RegistrationBean
getOrder, isEnabled, onStartup, setEnabled, setOrder
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.springframework.boot.autoconfigure.web.servlet.DispatcherServletPath
getPrefix, getRelativePath, getServletUrlMapping
Constructor Detail
DispatcherServletRegistrationBean
public DispatcherServletRegistrationBean(org.springframework.web.servlet.DispatcherServlet servlet, String path)
Create a newDispatcherServletRegistrationBean
instance for the given servlet and path.- Parameters:
servlet
- the dispatcher servletpath
- the dispatcher servlet path
Method Detail
getPath
public String getPath()
Description copied from interface:DispatcherServletPath
Returns the configured path of the dispatcher servlet.- Specified by:
getPath
in interfaceDispatcherServletPath
- Returns:
- the configured path
setUrlMappings
public void setUrlMappings(Collection<String> urlMappings)
- Overrides:
setUrlMappings
in classorg.springframework.boot.web.servlet.ServletRegistrationBean<org.springframework.web.servlet.DispatcherServlet>
addUrlMappings
public void addUrlMappings(String... urlMappings)
- Overrides:
addUrlMappings
in classorg.springframework.boot.web.servlet.ServletRegistrationBean<org.springframework.web.servlet.DispatcherServlet>