I am using ehcache-spring-annotations and the @Cacheable annotation (I would use the new @Cacheable in Spring 3.1, but it doesn't provide all that I need).
I'd like to set the cacheName variable to the value of an entry in a properties file, but if I try to use EL notation, it reads it as a literal string. Is there a way around this?
@Cacheable(cacheName = "${connectionCacheName}")
public MyConnection getMyConnection(String id) {
return new MyConnection(id);
}
In .properties file...
connectionCacheName=myConnectionCache
Exception:
Caused by: com.googlecode.ehcache.annotations.CacheNotFoundException: Unable to find cache '${connectionCacheName}'
This problem was due to my property placeholder not configured correctly in Spring.