beginnerFoundations: What Is Security, and Why Should You Care?
Why can't a filter directly call spring beans without DelegatingFilterProxy?
Servlet Filters are instantiated and managed by the servlet container's lifecycle (Tomcat), which has no knowledge of the Spring ApplicationContext. DelegatingFilterProxy is a thin bridging Filter registered with the container whose only job is to fetch the actual filter bean from the Spring context (by name) and delegate to it — this lets Spring-managed, dependency-injected filters participate in the plain servlet filter chain.
Ready to master this question?
Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.
Sign in to generate a response