Document need for -parameters flag in cache key generation exception messages
Closes gh-31675
This commit is contained in:
@@ -670,8 +670,10 @@ public abstract class CacheAspectSupport extends AbstractCacheInvoker
|
||||
private Object generateKey(CacheOperationContext context, @Nullable Object result) {
|
||||
Object key = context.generateKey(result);
|
||||
if (key == null) {
|
||||
throw new IllegalArgumentException("Null key returned for cache operation (maybe you are " +
|
||||
"using named params on classes without debug info?) " + context.metadata.operation);
|
||||
throw new IllegalArgumentException("""
|
||||
Null key returned for cache operation [%s]. If you are using named parameters, \
|
||||
ensure that the compiler uses the '-parameters' flag."""
|
||||
.formatted(context.metadata.operation));
|
||||
}
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Computed cache key '" + key + "' for operation " + context.metadata.operation);
|
||||
|
||||
Reference in New Issue
Block a user