参考这个
@Configuration
@ConditionalOnBean(RedisCacheManager.class)
public class CacheConfig extends CachingConfigurerSupport {
@Autowired
private RedisCacheManager redisCacheManager;
/**
* 重写这个方法,目的是用以提供默认的cacheManager
* @return
*/
@Override
public CacheManager cacheManager() {
return redisCacheManager;
}
}
扫一扫访问 Blade技术社区 移动端