Class DispatcherServletRegistrationBean
java.lang.Object
org.springframework.boot.web.servlet.RegistrationBean
org.springframework.boot.web.servlet.DynamicRegistrationBean<ServletRegistration.Dynamic>
org.springframework.boot.web.servlet.ServletRegistrationBean<DispatcherServlet>
org.springframework.boot.webmvc.autoconfigure.DispatcherServletRegistrationBean
- All Implemented Interfaces:
Aware, BeanNameAware, ServletContextInitializer, DispatcherServletPath, Ordered
public class DispatcherServletRegistrationBean
extends ServletRegistrationBean<DispatcherServlet>
implements DispatcherServletPath
ServletRegistrationBean for the auto-configured DispatcherServlet. Both
registers the servlet and exposes DispatcherServletPath information.- Since:
- 4.0.0
- Author:
- Phillip Webb
-
Field Summary
Fields inherited from interface Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
ConstructorsConstructorDescriptionDispatcherServletRegistrationBean(DispatcherServlet servlet, String path) Create a newDispatcherServletRegistrationBeaninstance for the given servlet and path. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddUrlMappings(String... urlMappings) Add URL mappings, as defined in the Servlet specification, for the servlet.getPath()Returns the configured path of the dispatcher servlet.voidsetUrlMappings(Collection<String> urlMappings) Set the URL mappings for the servlet.Methods inherited from class ServletRegistrationBean
addRegistration, configure, getDescription, getMultipartConfig, getServlet, getServletName, getUrlMappings, setLoadOnStartup, setMultipartConfig, setServlet, toStringMethods inherited from class DynamicRegistrationBean
addInitParameter, getInitParameters, getOrDeduceName, isAsyncSupported, register, setAsyncSupported, setBeanName, setIgnoreRegistrationFailure, setInitParameters, setNameMethods inherited from class RegistrationBean
getOrder, isEnabled, onStartup, setEnabled, setOrderMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface DispatcherServletPath
getPrefix, getRelativePath, getServletUrlMapping
-
Constructor Details
-
DispatcherServletRegistrationBean
Create a newDispatcherServletRegistrationBeaninstance for the given servlet and path.- Parameters:
servlet- the dispatcher servletpath- the dispatcher servlet path
-
-
Method Details
-
getPath
Description copied from interface:DispatcherServletPathReturns the configured path of the dispatcher servlet.- Specified by:
getPathin interfaceDispatcherServletPath- Returns:
- the configured path
-
setUrlMappings
Description copied from class:ServletRegistrationBeanSet the URL mappings for the servlet. If not specified the mapping will default to '/'. This will replace any previously specified mappings.- Overrides:
setUrlMappingsin classServletRegistrationBean<DispatcherServlet>- Parameters:
urlMappings- the mappings to set- See Also:
-
addUrlMappings
Description copied from class:ServletRegistrationBeanAdd URL mappings, as defined in the Servlet specification, for the servlet.- Overrides:
addUrlMappingsin classServletRegistrationBean<DispatcherServlet>- Parameters:
urlMappings- the mappings to add- See Also:
-