CacheCondition.java 文件源码

java
阅读 41 收藏 0 点赞 0 评论 0

项目:spring-boot-concourse 作者:
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context,
        AnnotatedTypeMetadata metadata) {
    RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(
            context.getEnvironment(), "spring.cache.");
    if (!resolver.containsProperty("type")) {
        return ConditionOutcome.match("Automatic cache type");
    }
    CacheType cacheType = CacheConfigurations
            .getType(((AnnotationMetadata) metadata).getClassName());
    String value = resolver.getProperty("type").replace("-", "_").toUpperCase();
    if (value.equals(cacheType.name())) {
        return ConditionOutcome.match("Cache type " + cacheType);
    }
    return ConditionOutcome.noMatch("Cache type " + value);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号