I am having a problem with @Cacheable and using a custom key based on Spring expression language. I have the following code
@Cacheable(value = "myCache", key = "#providerDTO.identifier")
ClientVO loadClientVOByProviderDTO(ProviderDTO providerDTO);
This is throwing the following error
org.springframework.expression.spel.SpelEvaluation Exception: EL1007Epos 0): Field or property 'identifier' cannot be found on null
The providerDTO argument is not null, I have verified this many times. The docs say that this should work so I am very confused. The docs give the following example
@Cacheable(value="books", key="#isbn.rawNumber")
I have also tried with a static method. This throws a NullPointerException because the providerDTO is null here.
public static String cacheKey(ProviderDTO providerDTO)
{
return providerDTO.identifier + "-" + providerDTO.clientID + "-" + providerDTO.clubID;
}
How can I debug this to find out what is happening? This is Spring 3.2.4-RELEASE. The @Cacheable tag is on an interface, but I am using standard spring AOP and not AspectJ so as far as I understand this should still work fine.