Class RegistrationBean
java.lang.Object
org.springframework.boot.web.servlet.RegistrationBean
- All Implemented Interfaces:
ServletContextInitializer,Ordered
- Direct Known Subclasses:
DynamicRegistrationBean,ServletListenerRegistrationBean
Base class for Servlet 3.0+ based registration beans.
- Since:
- 1.4.0
- Author:
- Phillip Webb
- See Also:
-
Field Summary
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract StringReturn a description of the registration.intgetOrder()Get the order of the registration bean.booleanReturn if the registration is enabled.final voidonStartup(ServletContext servletContext) Configure the givenServletContextwith any servlets, filters, listeners context-params and attributes necessary for initialization.protected abstract voidregister(String description, ServletContext servletContext) Register this bean with the servlet context.voidsetEnabled(boolean enabled) Flag to indicate that the registration is enabled.voidsetOrder(int order) Set the order of the registration bean.
-
Constructor Details
-
RegistrationBean
public RegistrationBean()
-
-
Method Details
-
onStartup
Description copied from interface:ServletContextInitializerConfigure the givenServletContextwith any servlets, filters, listeners context-params and attributes necessary for initialization.- Specified by:
onStartupin interfaceServletContextInitializer- Parameters:
servletContext- theServletContextto initialize- Throws:
ServletException- if any call against the givenServletContextthrows aServletException
-
getDescription
Return a description of the registration. For example "Servlet resourceServlet"- Returns:
- a description of the registration
-
register
Register this bean with the servlet context.- Parameters:
description- a description of the item being registeredservletContext- the servlet context
-
setEnabled
public void setEnabled(boolean enabled) Flag to indicate that the registration is enabled.- Parameters:
enabled- the enabled to set
-
isEnabled
public boolean isEnabled()Return if the registration is enabled.- Returns:
- if enabled (default
true)
-
setOrder
public void setOrder(int order) Set the order of the registration bean.- Parameters:
order- the order
-
getOrder
public int getOrder()Get the order of the registration bean.
-