title: Caching in Spring on methods with array parameters
body: <p>I have a service with multiple methods and am attempting to cache them using Spring <code>@Cacheable</code> annotations. Everything works fine except I've found the methods with an array as a method parameter are not cached. This somewhat makes sense considering arrays can hold different values, but I would still think it would be possible.</p>
  
  <p>The following methods are cached:</p>
  
  <pre><code>@Cacheable("myCache")
  public Collection&lt;Building&gt; findBuildingByCode(String buildingCode) {...}
  
  @Cacheable("myCache")
  public Collection&lt;Building&gt; getBuildings() {...}
  </code></pre>
  
  <p>However, if I change the <code>findBuildingByCode</code> method to either of the following, it is not cached:</p>
  
  <pre><code>@Cacheable("myCache") 
  public Collection&lt;Building&gt; findBuildingByCode(String[] buildingCode) {...}
  
  @Cacheable("myCache")
  public Collection&lt;Building&gt; findBuildingByCode(String... buildingCode) {...}
  </code></pre>
  
  <p>Here is the relevant <strong>Spring xml</strong> configuration:</p>
  
  <pre><code>&lt;!-- Cache beans --&gt;
  &lt;cache:annotation-driven/&gt;
  
  &lt;bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager"
      p:cache-manager-ref="ehcache" /&gt;
  
  &lt;!-- EhCache library setup --&gt;
  &lt;bean id="ehcache"
      class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean" /&gt;
  </code></pre>
  
  <p><strong>Ehcache</strong> configuration:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd"
  updateCheck="false"&gt;
  
  &lt;diskStore path="java.io.tmpdir/ehcache" /&gt;
  
  &lt;!-- Default settings --&gt;
  &lt;defaultCache eternal="false" maxElementsInMemory="1"
      overflowToDisk="false" diskPersistent="false" timeToIdleSeconds="0"
      timeToLiveSeconds="100" memoryStoreEvictionPolicy="LRU" /&gt;
  
  &lt;!-- Other caches --&gt;
  
  &lt;cache name="myCache" eternal="false" maxElementsInMemory="500"
      overflowToDisk="false" diskPersistent="false" timeToIdleSeconds="0"
      timeToLiveSeconds="43200" memoryStoreEvictionPolicy="LRU" /&gt;
  
   &lt;/ehcache&gt;
  </code></pre>
  
  <p>Is this known functionality or a bug?</p>