My decision is inspired by Rob Vinca's answer. Although, in my scenario, Spring was saving requests with the X-Requested-With: XMLHttpRequest setting. These were requests that I had to ignore.
I created a class that will be my regular RequestCache class.
@Service("customRequestCache") public class CustomRequestCache extends HttpSessionRequestCache {
Then in my Spring Security Configuration:
<http> <request-cache ref="customRequestCache" /> </http>
When using this custom request cache class, ajax requests are no longer saved.
source share