I have a method which is annotated as @Cacheable
and Gemfire is also configured for caching.
The mehtod works fine when returing Not Null values. But if it returns Null then Gemfire throws exception as below :
Caused by: java.lang.NullPointerException: value must not be null
com.gemstone.gemfire.internal.cache.LocalRegion.newUpdateEntryEvent(LocalRegion.java:1744)
at com.gemstone.gemfire.internal.cache.LocalRegion.put(LocalRegion.java:1705)
at com.gemstone.gemfire.internal.cache.AbstractRegion.put(AbstractRegion.java:286)
at org.springframework.data.gemfire.support.GemfireCache.put(GemfireCache.java:68)
Method as below :
@Override
@Cachable("date_cache")
public String getData(String value){
return myDataRepository.getLabelByValue(value);
}
If myDataRepository.getLabelByValue(value)
is null then NullPointerException is throw in Gemfire and there is some data retured from database then it works fine.
Please help if there is any config to ignore null value caching in Gemfire.