Annotating interfaces or interface methods with ``++@Cache*++`` annotations is not recommended by the official Spring documentation:
----
Spring recommends that you only annotate concrete classes (and methods of concrete classes) with the @Cache* annotations, as opposed to annotating interfaces. You certainly can place an @Cache* annotation on an interface (or an interface method), but this works only if you use the proxy mode (mode="proxy"). If you use the weaving-based aspect (mode="aspectj"), the caching settings are not recognized on interface-level declarations by the weaving infrastructure.
----
Also, when a method is annotated as cacheable inside an interface, if two different implementations of that method exist, the first one to be invoked will populate the cache.
Subsequent calls will always return the cached value, even if it's the other implementation being called.
* *Confusing Code*: Developers may mistakenly believe that caching is in effect, leading to confusion and incorrect assumptions about application performance.
* *Unreliable Code*: Annotating interface methods as ``++@Cacheable++`` hides the cache name from the implementing classes, making it hard to detect where a conflict of names might occur, causing unexpected results at runtime.
In the following example, if our application has two different rest APIs to query the most popular animal in two different zoos, the first zoo to be queried will populate the cache.
Calls to a different API to query the other zoo will produce the same cached output, invalidating our application's business logic.
[source,java,diff-id=2,diff-type=noncompliant]
----
public interface Zoo {
@Cacheable("popAnimal") //non compliant, interface method is annotated with @Cacheable