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 ofFilter
to 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 Filter
s 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 ServletRegistrationBean
s). 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:
-
ServletContextInitializer
ServletContext.addFilter(String, Filter)
DelegatingFilterProxyRegistrationBean
-
Field Summary
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Constructor Summary
ConstructorDescriptionCreate a newFilterRegistrationBean
instance.FilterRegistrationBean
(T filter, ServletRegistrationBean<?>... servletRegistrationBeans) Create a newFilterRegistrationBean
instance to be registered with the specifiedServletRegistrationBean
s. -
Method Summary
Methods inherited from class org.springframework.boot.web.servlet.AbstractFilterRegistrationBean
addRegistration, addServletNames, addServletRegistrationBeans, addUrlPatterns, configure, determineDispatcherTypes, getDescription, getFilterName, getServletNames, getServletRegistrationBeans, getUrlPatterns, isMatchAfter, setDispatcherTypes, setDispatcherTypes, setMatchAfter, setServletNames, setServletRegistrationBeans, setUrlPatterns, toString
Methods inherited from class org.springframework.boot.web.servlet.DynamicRegistrationBean
addInitParameter, getInitParameters, getOrDeduceName, isAsyncSupported, register, setAsyncSupported, setBeanName, setIgnoreRegistrationFailure, setInitParameters, setName
Methods inherited from class org.springframework.boot.web.servlet.RegistrationBean
getOrder, isEnabled, onStartup, setEnabled, setOrder
-
Constructor Details
-
FilterRegistrationBean
public FilterRegistrationBean()Create a newFilterRegistrationBean
instance. -
FilterRegistrationBean
Create a newFilterRegistrationBean
instance to be registered with the specifiedServletRegistrationBean
s.- Parameters:
filter
- the filter to registerservletRegistrationBeans
- associateServletRegistrationBean
s
-
-
Method Details
-
getFilter
Description copied from class:AbstractFilterRegistrationBean
Return theFilter
to be registered.- Specified by:
getFilter
in classAbstractFilterRegistrationBean<T extends jakarta.servlet.Filter>
- Returns:
- the filter
-
setFilter
Set the filter to be registered.- Parameters:
filter
- the filter
-