Class FilterRegistrationBean<T extends jakarta.servlet.Filter>
java.lang.Object
org.springframework.boot.web.servlet.RegistrationBean
org.springframework.boot.web.servlet.DynamicRegistrationBean<jakarta.servlet.FilterRegistration.Dynamic>
org.springframework.boot.web.servlet.AbstractFilterRegistrationBean<T>
org.springframework.boot.web.servlet.FilterRegistrationBean<T>
- Type Parameters:
T- the type ofFilterto register
- All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanNameAware, ServletContextInitializer, org.springframework.core.Ordered
public class FilterRegistrationBean<T extends jakarta.servlet.Filter>
extends AbstractFilterRegistrationBean<T>
A
ServletContextInitializer to register Filters in a Servlet 3.0+
container. Similar to the registration
features provided by ServletContext but with a Spring Bean friendly design.
The Filter must be specified before calling
RegistrationBean.onStartup(ServletContext). Registrations can be associated with
URL patterns and/or servlets (either by name or through a ServletRegistrationBeans). When
no URL pattern or servlets are specified the filter will be associated to '/*'. The
filter name will be deduced if not specified.
- Since:
- 1.4.0
- See Also:
-
Field Summary
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
ConstructorsConstructorDescriptionCreate a newFilterRegistrationBeaninstance.FilterRegistrationBean(T filter, ServletRegistrationBean<?>... servletRegistrationBeans) Create a newFilterRegistrationBeaninstance to be registered with the specifiedServletRegistrationBeans. -
Method Summary
Methods inherited from class AbstractFilterRegistrationBean
addRegistration, addServletNames, addServletRegistrationBeans, addUrlPatterns, configure, determineDispatcherTypes, getDescription, getFilterName, getServletNames, getServletRegistrationBeans, getUrlPatterns, isMatchAfter, setDispatcherTypes, setDispatcherTypes, setMatchAfter, setServletNames, setServletRegistrationBeans, setUrlPatterns, toStringMethods inherited from class DynamicRegistrationBean
addInitParameter, getInitParameters, getOrDeduceName, isAsyncSupported, register, setAsyncSupported, setBeanName, setIgnoreRegistrationFailure, setInitParameters, setNameMethods inherited from class RegistrationBean
getOrder, isEnabled, onStartup, setEnabled, setOrder
-
Constructor Details
-
FilterRegistrationBean
public FilterRegistrationBean()Create a newFilterRegistrationBeaninstance. -
FilterRegistrationBean
Create a newFilterRegistrationBeaninstance to be registered with the specifiedServletRegistrationBeans.- Parameters:
filter- the filter to registerservletRegistrationBeans- associateServletRegistrationBeans
-
-
Method Details
-
getFilter
Description copied from class:AbstractFilterRegistrationBeanReturn theFilterto be registered.- Specified by:
getFilterin classAbstractFilterRegistrationBean<T extends jakarta.servlet.Filter>- Returns:
- the filter
-
setFilter
-