Is there a way to use spring filter chains without spring-security?

I want to add some filters to my spring web application, but they will not have anything about security, at least for now. So. All I can do without spring-security is to define several filters in web.xml (the old way to define filters). It seems strange that to use spring filter chains, I need to add spring-security as a dependency for my project. Maybe I'm doing something wrong, and really there are chains of filters that can be used without spring-security dependency?

+4
source share
2 answers

Spring Security is able to combine multiple filters into one filter using FilterChainProxy , which is included in Spring Security. Since the code exists in Spring Security, you cannot use it without adding a dependency on spring-security-web, without copying the code into your own project (which is acceptable for a license). FilterChainProxy is indeed a Spring Bean specific filter delegated by the delegation of FilterProxy. So it looks like

DelegatingFilterProxy
  -> delegates to FilterChainProxy
     -> delegates to multiple Filter defined on the FilterChainProxy
+3
source

You can use DelegatingFilterProxy . This Spring Forum Entries provides a good example of how to use it.

+1
source

All Articles