Java 类org.springframework.security.oauth2.config.annotation.web.configuration.EnableOAuth2Client 实例源码

项目:service-authorization    文件:OAuthSecurityConfig.java   
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) {
    String[] enablers = context.getBeanFactory().getBeanNamesForAnnotation(EnableOAuth2Client.class);
    boolean extensions = Arrays.stream(enablers)
            .filter(name -> !context.getBeanFactory().getType(name).equals(OAuthSecurityConfig.class))
            .anyMatch(name -> context.getBeanFactory().isTypeMatch(name, OAuthSecurityConfig.class));
    if (extensions) {
        return ConditionOutcome.noMatch("found @EnableOAuth2Client on a OAuthSecurityConfig subclass");
    } else {
        return ConditionOutcome.match("found no @EnableOAuth2Client on a OAuthSecurityConfig subsclass");
    }

}