0
我使用了ehcache-spring-annotations和@Cacheable註解(我將在Spring 3.1中使用新的@Cacheable,但它不提供所有我需要的)。將屬性值賦值給Spring中的Annotation值
我想將cacheName變量設置爲屬性文件中某個條目的值,但是如果我嘗試使用EL表示法,則會將其作爲文字字符串讀取。有沒有解決的辦法?
@Cacheable(cacheName = "${connectionCacheName}")
public MyConnection getMyConnection(String id) {
return new MyConnection(id);
}
在屬性文件...
connectionCacheName=myConnectionCache
例外:
Caused by: com.googlecode.ehcache.annotations.CacheNotFoundException: Unable to find cache '${connectionCacheName}'