Class ApplicationContextRequestMatcher<C>
java.lang.Object
org.springframework.boot.security.servlet.ApplicationContextRequestMatcher<C>
- Type Parameters:
- C- the type of the context that the match method actually needs to use. Can be an- ApplicationContextor a class of an- existing bean.
- All Implemented Interfaces:
- org.springframework.security.web.util.matcher.RequestMatcher
public abstract class ApplicationContextRequestMatcher<C>
extends Object
implements org.springframework.security.web.util.matcher.RequestMatcher
ApplicationContext backed RequestMatcher. Can work directly with the
 ApplicationContext, obtain an existing bean or
 create a new bean that is
 autowired in the usual way.- Since:
- 2.0.0
- 
Nested Class SummaryNested classes/interfaces inherited from interface org.springframework.security.web.util.matcher.RequestMatcherorg.springframework.security.web.util.matcher.RequestMatcher.MatchResult
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected booleanignoreApplicationContext(org.springframework.web.context.WebApplicationContext webApplicationContext) Returns if theWebApplicationContextshould be ignored and not used for matching.protected voidinitialized(Supplier<C> context) Method that can be implemented by subclasses that wish to initialize items the first time that the matcher is called.final booleanmatches(jakarta.servlet.http.HttpServletRequest request) protected abstract booleanDecides whether the rule implemented by the strategy matches the supplied request.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.security.web.util.matcher.RequestMatchermatcher
- 
Constructor Details- 
ApplicationContextRequestMatcher
 
- 
- 
Method Details- 
matchespublic final boolean matches(jakarta.servlet.http.HttpServletRequest request) - Specified by:
- matchesin interface- org.springframework.security.web.util.matcher.RequestMatcher
 
- 
ignoreApplicationContextprotected boolean ignoreApplicationContext(org.springframework.web.context.WebApplicationContext webApplicationContext) Returns if theWebApplicationContextshould be ignored and not used for matching. If this method returnstruethen the context will not be used and thematchesmethod will returnfalse.- Parameters:
- webApplicationContext- the candidate web application context
- Returns:
- if the application context should be ignored
- Since:
- 2.1.8
 
- 
initializedMethod that can be implemented by subclasses that wish to initialize items the first time that the matcher is called. This method will be called only once and only ifignoreApplicationContext(WebApplicationContext)returnsfalse. Note that the supplied context will be based on the first request sent to the matcher.- Parameters:
- context- a supplier for the initialized context (may throw an exception)
- See Also:
 
- 
matchesprotected abstract boolean matches(jakarta.servlet.http.HttpServletRequest request, Supplier<C> context) Decides whether the rule implemented by the strategy matches the supplied request.- Parameters:
- request- the source request
- context- a supplier for the initialized context (may throw an exception)
- Returns:
- if the request matches
 
 
-