advancedSpring Internals — Bean Lifecycle & Proxies
Why can a poorly written OncePerRequestFilter execute multiple times for a single request?
OncePerRequestFilter guards against re-execution using a request attribute flag — but internal dispatches (forward, include, async dispatch, error dispatch) with a DIFFERENT request object, or a filter registered under multiple filter-chain matches, can each re-trigger it since the 'already filtered' marker doesn't always carry over.
This is a Pro question
Sign in, then upgrade to Pro or Power to unlock this question and the full Interview Prep bank.
Why can a poorly written OncePerRequestFilter execute multiple times for a single request?