Yes, you need settings in both places. The ehcache.xml values ββconfigure the cache settings, but they will be ignored unless you enable caching for each domain class (and possibly associated collections).
Normally, you would not use the same settings in the defaultCache block, though, since each domain class usually requires different settings, for example
<cache name='com.yourapp.SomeDomainClass' maxElementsInMemory='1000' eternal='true' maxElementsOnDisk='0'> <cacheEventListenerFactory class='net.sf.ehcache.distribution.RMICacheReplicatorFactory' properties='replicateAsynchronously=false replicatePutsViaCopy=false, replicateUpdatesViaCopy=false, replicatePuts=true, replicateUpdates=true, replicateRemovals=true' /> </cache>
source share