diff --git a/src/docs/asciidoc/integration.adoc b/src/docs/asciidoc/integration.adoc index 20d4d249fc1..2d3f3f54f67 100644 --- a/src/docs/asciidoc/integration.adoc +++ b/src/docs/asciidoc/integration.adoc @@ -8327,11 +8327,12 @@ supported wrapper so the previous example can be rewritten as follows: [source,java,indent=0] [subs="verbatim,quotes"] ---- - @Cacheable(cacheNames="book", condition="#name.length() < 32", **unless="#result.hardback"**) + @Cacheable(cacheNames="book", condition="#name.length() < 32", **unless="#result?.hardback"**) public Optional findBook(String name) ---- -Note that `result` still refers to `Book` and not `Optional`. +Note that `result` still refers to `Book` and not `Optional`. As it might be `null`, we +should use the safe navigation operator. [[cache-spel-context]] ===== Available caching SpEL evaluation context