44package com .alicp .jetcache .anno .support ;
55
66import com .alicp .jetcache .CacheManager ;
7+ import com .alicp .jetcache .SimpleCacheManager ;
78import com .alicp .jetcache .anno .Cached ;
89import com .alicp .jetcache .anno .config .EnableMethodCache ;
910import com .alicp .jetcache .test .anno .TestUtil ;
1011import com .alicp .jetcache .test .spring .SpringTestBase ;
1112import org .junit .Assert ;
1213import org .junit .Test ;
1314import org .junit .runner .RunWith ;
15+ import org .springframework .beans .factory .annotation .Autowired ;
16+ import org .springframework .context .ApplicationContext ;
1417import org .springframework .context .annotation .Bean ;
1518import org .springframework .context .annotation .Configuration ;
16- import org .springframework .context .annotation .Import ;
1719import org .springframework .test .context .ContextConfiguration ;
1820import org .springframework .test .context .junit4 .SpringJUnit4ClassRunner ;
1921
2426@ ContextConfiguration (classes = ConfigProvider_CustomCacheManager_Test .class )
2527@ Configuration
2628@ EnableMethodCache (basePackages = {"com.alicp.jetcache.anno.support.ConfigProvider_CustomCacheManager_Test" })
27- @ Import (JetCacheBaseBeans .class )
2829public class ConfigProvider_CustomCacheManager_Test extends SpringTestBase {
2930
3031 @ Bean
@@ -33,6 +34,20 @@ public GlobalCacheConfig config() {
3334 return pc ;
3435 }
3536
37+ @ Bean
38+ public SpringConfigProvider springConfigProvider (
39+ @ Autowired ApplicationContext context ,
40+ @ Autowired GlobalCacheConfig config ) {
41+ return new JetCacheBaseBeans ().springConfigProvider (context , config , null , null , null );
42+ }
43+
44+ @ Bean
45+ public SimpleCacheManager cacheManager (@ Autowired ConfigProvider configProvider ) {
46+ SimpleCacheManager cacheManager = new SimpleCacheManager ();
47+ cacheManager .setCacheBuilderTemplate (configProvider .getCacheBuilderTemplate ());
48+ return cacheManager ;
49+ }
50+
3651 public static class CountBean {
3752 private int i ;
3853
0 commit comments