Search in sources :

Example 6 with ConfigMap

use of com.alicp.jetcache.anno.support.ConfigMap in project jetcache by alibaba.

the class SpringCacheContext method init.

public void init() {
    if (applicationContext != null) {
        ConfigMap configMap = applicationContext.getBean(ConfigMap.class);
        cacheManager.setCacheCreator((area, cacheName) -> {
            CacheInvokeConfig cic = configMap.getByCacheName(area, cacheName);
            if (cic == null) {
                throw new IllegalArgumentException("cache definition not found: area=" + area + ",cacheName=" + cacheName);
            }
            return __createOrGetCache(cic.getCachedAnnoConfig(), area, cacheName);
        });
    }
}
Also used : ConfigMap(com.alicp.jetcache.anno.support.ConfigMap)

Aggregations

ConfigMap (com.alicp.jetcache.anno.support.ConfigMap)6 BeforeEach (org.junit.jupiter.api.BeforeEach)3 ConfigProvider (com.alicp.jetcache.anno.support.ConfigProvider)2 GlobalCacheConfig (com.alicp.jetcache.anno.support.GlobalCacheConfig)2 CountClass (com.alicp.jetcache.testsupport.CountClass)2 CacheInvalidateAnnoConfig (com.alicp.jetcache.anno.support.CacheInvalidateAnnoConfig)1 CacheUpdateAnnoConfig (com.alicp.jetcache.anno.support.CacheUpdateAnnoConfig)1 Method (java.lang.reflect.Method)1 Before (org.junit.Before)1