Java 类org.springframework.boot.autoconfigure.security.oauth2.client.EnableOAuth2Sso 实例源码

项目:onetwo    文件:NotEnableOauth2SsoCondition.java   
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) {
    String ssoClass = "org.springframework.boot.autoconfigure.security.oauth2.client.EnableOAuth2Sso";
    boolean ssoClientAnnotationExists = ClassUtils.isPresent(ssoClass, null);
    if(!ssoClientAnnotationExists){
        return ConditionOutcome.match("EnableOAuth2Sso not exists!");
    }
    String[] beanNames = context.getBeanFactory().getBeanNamesForAnnotation(EnableOAuth2Sso.class);
    if(beanNames==null || beanNames.length==0){
        return ConditionOutcome.match("not @EnableOAuth2Sso bean found!");
    }
    return ConditionOutcome.noMatch("@EnableOAuth2Sso sso client!");
}