You can specify the default key generator on the <ehcache:annotation-driven /> element in your spring context file
<ehcache:annotation-driven default-cache-key-generator="myKeyGenerator"/>
<bean id="myKeyGenerator" class="com.example.cache.MyCustomCacheKeyGenerator"/>
If you don't ever specify a key generator anywhere HashCodeCacheKeyGenerator will be used. It generates a Java long value that represents a reasonable combination of the hash codes of the method and arguments. The ListCacheKeyGenerator for example generates a List object that contains the method and arguments and when the key is compared List.equals is used.
-Eric