Hi folks,
I asked this question
elsewhere a few days ago but nobody's been able to assist - hopefully someone here can help.
I've developed a method that is annotated with @PreAuthorize. The @PreAuthorize annonation runs a method (called isStringInList(
String s)) on a separate class (a @Service that I've qualified as "myStringEvaluationService") to ensure that the method returns true.
I'm using Postman to send HTTP requests to the method. If I send a String that is on the list the above method executes fine. If I send a String that isn't on the list then the method doesn't execute - this is fine, it's how I want it to behave. It sends a 403 - Forbidden message back to Postman.
The problem is when I resubmit a String that is on the list, I see from debugging that the String that is not on the list is what gets sent for every subsequent request. For some reason the 403 error doesn't result in the myString variable being refreshed. Why might this be happening? There's obviously some form of caching taking place somewhere but I'm unsure how to clear the cache when it comes to SpEL variables.