Class RegistrationBean
java.lang.Object
org.springframework.boot.web.servlet.RegistrationBean
- All Implemented Interfaces:
- ServletContextInitializer,- org.springframework.core.Ordered
- Direct Known Subclasses:
- DynamicRegistrationBean,- ServletListenerRegistrationBean
public abstract class RegistrationBean
extends Object
implements ServletContextInitializer, org.springframework.core.Ordered
Base class for Servlet 3.0+ based registration beans.
- 
Field SummaryFields inherited from interface org.springframework.core.OrderedHIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
- 
Constructor SummaryConstructors
- 
Method SummaryModifier 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(jakarta.servlet.ServletContext servletContext) Configure the givenServletContextwith any servlets, filters, listeners context-params and attributes necessary for initialization.protected abstract voidRegister 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- 
RegistrationBeanpublic RegistrationBean()
 
- 
- 
Method Details- 
onStartuppublic final void onStartup(jakarta.servlet.ServletContext servletContext) throws jakarta.servlet.ServletException Description copied from interface:ServletContextInitializerConfigure the givenServletContextwith any servlets, filters, listeners context-params and attributes necessary for initialization.- Specified by:
- onStartupin interface- ServletContextInitializer
- Parameters:
- servletContext- the- ServletContextto initialize
- Throws:
- jakarta.servlet.ServletException- if any call against the given- ServletContextthrows a- ServletException
 
- 
getDescriptionReturn a description of the registration. For example "Servlet resourceServlet"- Returns:
- a description of the registration
 
- 
registerRegister this bean with the servlet context.- Parameters:
- description- a description of the item being registered
- servletContext- the servlet context
 
- 
setEnabledpublic void setEnabled(boolean enabled) Flag to indicate that the registration is enabled.- Parameters:
- enabled- the enabled to set
 
- 
isEnabledpublic boolean isEnabled()Return if the registration is enabled.- Returns:
- if enabled (default true)
 
- 
setOrderpublic void setOrder(int order) Set the order of the registration bean.- Parameters:
- order- the order
 
- 
getOrderpublic int getOrder()Get the order of the registration bean.- Specified by:
- getOrderin interface- org.springframework.core.Ordered
- Returns:
- the order
 
 
-