I've already found some questions related to this topic but I've realised that none of them shed light on this topic.
Apparently the OncePerRequestFilter ensures that a request passes through the filter only once in the filter chain, but it's not exactly clear to me when the opposite would happen.
It would be nice to see some scenarios in which to use one or the other. Also an example on when and how the filter might be applied several times on the filter chain.
For e.g.
- For a JWT filter which implementation should be used and why?
- For a CORS filter which implementation should be used and why? etc.