当前位置: 首页>>代码示例>>Java>>正文


Java ConditionMessage.Builder方法代码示例

本文整理汇总了Java中org.springframework.boot.autoconfigure.condition.ConditionMessage.Builder方法的典型用法代码示例。如果您正苦于以下问题:Java ConditionMessage.Builder方法的具体用法?Java ConditionMessage.Builder怎么用?Java ConditionMessage.Builder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.boot.autoconfigure.condition.ConditionMessage的用法示例。


在下文中一共展示了ConditionMessage.Builder方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getMatchOutcome

import org.springframework.boot.autoconfigure.condition.ConditionMessage; //导入方法依赖的package包/类
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context,
		AnnotatedTypeMetadata metadata) {
	ConditionMessage.Builder message = ConditionMessage
			.forCondition("OAuth JWT Condition");
	Environment environment = context.getEnvironment();
	String keyValue = environment
			.getProperty("security.oauth2.resource.jwt.key-value");
	String keyUri = environment
			.getProperty("security.oauth2.resource.jwt.key-uri");
	if (StringUtils.hasText(keyValue) || StringUtils.hasText(keyUri)) {
		return ConditionOutcome
				.match(message.foundExactly("provided public key"));
	}
	return ConditionOutcome
			.noMatch(message.didNotFind("provided public key").atAll());
}
 
开发者ID:spring-projects,项目名称:spring-security-oauth2-boot,代码行数:18,代码来源:ResourceServerTokenServicesConfiguration.java

示例2: getMatchOutcome

import org.springframework.boot.autoconfigure.condition.ConditionMessage; //导入方法依赖的package包/类
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context,
		AnnotatedTypeMetadata metadata) {
	String[] enablers = context.getBeanFactory()
			.getBeanNamesForAnnotation(EnableOAuth2Sso.class);
	ConditionMessage.Builder message = ConditionMessage
			.forCondition("@EnableOAuth2Sso Condition");
	for (String name : enablers) {
		if (context.getBeanFactory().isTypeMatch(name,
				WebSecurityConfigurerAdapter.class)) {
			return ConditionOutcome.match(message
					.found("@EnableOAuth2Sso annotation on WebSecurityConfigurerAdapter")
					.items(name));
		}
	}
	return ConditionOutcome.noMatch(message.didNotFind(
			"@EnableOAuth2Sso annotation " + "on any WebSecurityConfigurerAdapter")
			.atAll());
}
 
开发者ID:spring-projects,项目名称:spring-security-oauth2-boot,代码行数:20,代码来源:EnableOAuth2SsoCondition.java

示例3: getMatchOutcome

import org.springframework.boot.autoconfigure.condition.ConditionMessage; //导入方法依赖的package包/类
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context,
		AnnotatedTypeMetadata metadata) {
	ConditionMessage.Builder message = ConditionMessage
			.forCondition("EmbeddedDataSource");
	if (anyMatches(context, metadata, this.pooledCondition)) {
		return ConditionOutcome
				.noMatch(message.foundExactly("supported pooled data source"));
	}
	EmbeddedDatabaseType type = EmbeddedDatabaseConnection
			.get(context.getClassLoader()).getType();
	if (type == null) {
		return ConditionOutcome
				.noMatch(message.didNotFind("embedded database").atAll());
	}
	return ConditionOutcome.match(message.found("embedded database").items(type));
}
 
开发者ID:muxiangqiu,项目名称:spring-boot-multidatasource,代码行数:18,代码来源:DataSourceAutoConfiguration.java

示例4: getMatchOutcome

import org.springframework.boot.autoconfigure.condition.ConditionMessage; //导入方法依赖的package包/类
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata md) {
	String sourceClass = "";
	if (md instanceof ClassMetadata) {
		sourceClass = ((ClassMetadata) md).getClassName();
	}
	ConditionMessage.Builder message = ConditionMessage.forCondition("ZipkinSender", sourceClass);
	String property = context.getEnvironment()
			.getProperty("spring.zipkin.sender.type");
	if (StringUtils.isEmpty(property)) {
		return ConditionOutcome.match(message.because("automatic sender type"));
	}
	String senderType = getType(((AnnotationMetadata) md).getClassName());
	if (property.equals(senderType)) {
		return ConditionOutcome.match(message.because(property + " sender type"));
	}
	return ConditionOutcome.noMatch(message.because(property + " sender type"));
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-sleuth,代码行数:19,代码来源:ZipkinSenderCondition.java

示例5: getMatchOutcome

import org.springframework.boot.autoconfigure.condition.ConditionMessage; //导入方法依赖的package包/类
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) {
    Map<String, Object> attributes = metadata.getAnnotationAttributes(ConditionalOnOperatingSystem.class.getName());
    OperatingSystem operatingSystem = (OperatingSystem) attributes.get("value");
    ConditionMessage.Builder message = ConditionMessage.forCondition(ConditionalOnOperatingSystem.class);
    String name = operatingSystem.name();
    if (operatingSystem == OperatingSystem.WINDOWS && SystemInformation.INSTANCE.isWindows()) {
        return ConditionOutcome.match(message.foundExactly(name));
    }
    if (operatingSystem == OperatingSystem.UNIX && SystemInformation.INSTANCE.isUnix()) {
        return ConditionOutcome.match(message.foundExactly(name));
    }
    return ConditionOutcome.noMatch(message.didNotFind(name).atAll());
}
 
开发者ID:gavlyukovskiy,项目名称:azure-application-insights-spring-boot-starter,代码行数:15,代码来源:OnOperationSystemCondition.java

示例6: getMatchOutcome

import org.springframework.boot.autoconfigure.condition.ConditionMessage; //导入方法依赖的package包/类
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context,
		AnnotatedTypeMetadata metadata) {
	String clientId = context.getEnvironment()
			.getProperty("security.oauth2.client.client-id");
	ConditionMessage.Builder message = ConditionMessage
			.forCondition("OAuth Client ID");
	if (StringUtils.hasLength(clientId)) {
		return ConditionOutcome.match(message
				.foundExactly("security.oauth2.client.client-id property"));
	}
	return ConditionOutcome.noMatch(message
			.didNotFind("security.oauth2.client.client-id property").atAll());
}
 
开发者ID:spring-projects,项目名称:spring-security-oauth2-boot,代码行数:15,代码来源:OAuth2RestOperationsConfiguration.java

示例7: getMatchOutcome

import org.springframework.boot.autoconfigure.condition.ConditionMessage; //导入方法依赖的package包/类
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) {
    ConditionMessage.Builder message = ConditionMessage.forCondition("FlexyPoolConfigurationAvailable");
    String propertiesFilePath = System.getProperty(PropertyLoader.PROPERTIES_FILE_PATH);
    if (propertiesFilePath != null && ClassLoaderUtils.getResource(propertiesFilePath) != null) {
        return ConditionOutcome.match(message.found("FlexyPool configuration file").items(propertiesFilePath));
    }
    if (ClassLoaderUtils.getResource(PropertyLoader.PROPERTIES_FILE_NAME) != null) {
        return ConditionOutcome.match(message.found("FlexyPool configuration file").items(PropertyLoader.PROPERTIES_FILE_NAME));
    }
    return ConditionOutcome.noMatch(message.didNotFind("FlexyPool configuration file").atAll());
}
 
开发者ID:gavlyukovskiy,项目名称:spring-boot-data-source-decorator,代码行数:13,代码来源:FlexyPoolConfiguration.java

示例8: getMatchOutcome

import org.springframework.boot.autoconfigure.condition.ConditionMessage; //导入方法依赖的package包/类
@Override
public ConditionOutcome getMatchOutcome(
    ConditionContext conditionContext,
    AnnotatedTypeMetadata annotatedTypeMetadata) {
    boolean groupEnabled = isEnabled(conditionContext,
        "camel.component.", true);
    ConditionMessage.Builder message = ConditionMessage
        .forCondition("camel.component.syndesis-http");
    if (isEnabled(conditionContext, "camel.component.syndesis-http.",
        groupEnabled)) {
        return ConditionOutcome.match(message.because("enabled"));
    }
    return ConditionOutcome.noMatch(message.because("not enabled"));
}
 
开发者ID:syndesisio,项目名称:syndesis,代码行数:15,代码来源:HttpComponentAutoConfiguration.java

示例9: getMatchOutcome

import org.springframework.boot.autoconfigure.condition.ConditionMessage; //导入方法依赖的package包/类
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) {
	ConditionMessage.Builder message = ConditionMessage.forCondition("OpenID Session Management Condition");
	Environment environment = context.getEnvironment();
	boolean enabled = environment.getProperty("op.session-management.enabled", Boolean.class, false);

	if (enabled) {
		return ConditionOutcome.match(message.found("property", "properties")
				.items(ConditionMessage.Style.QUOTE, "op.session-management.enabled"));
	}
	else {
		return ConditionOutcome.noMatch(message.didNotFind("property", "properties")
				.items(ConditionMessage.Style.QUOTE, "op.session-management.enabled"));
	}
}
 
开发者ID:vpavic,项目名称:simple-openid-provider,代码行数:16,代码来源:LogoutConfiguration.java

示例10: getMatchOutcome

import org.springframework.boot.autoconfigure.condition.ConditionMessage; //导入方法依赖的package包/类
@Override
public ConditionOutcome getMatchOutcome(
    final ConditionContext context, final AnnotatedTypeMetadata metadata) {
  final boolean endpointsEnabled = isEnabled(context, "endpoints.", true);
  final ConditionMessage.Builder message = ConditionMessage.forCondition("Failsafe");
  if (isEnabled(context, "endpoints.failsafe.", endpointsEnabled)) {
    return ConditionOutcome.match(message.because("enabled"));
  }
  return ConditionOutcome.noMatch(message.because("not enabled"));
}
 
开发者ID:zalando,项目名称:failsafe-actuator,代码行数:11,代码来源:FailsafeAutoConfiguration.java

示例11: getMatchOutcome

import org.springframework.boot.autoconfigure.condition.ConditionMessage; //导入方法依赖的package包/类
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context,
		AnnotatedTypeMetadata metadata) {
	ConditionMessage.Builder message = ConditionMessage
			.forCondition("OAuth ResourceServer Condition");
	Environment environment = context.getEnvironment();
	if (!(environment instanceof ConfigurableEnvironment)) {
		return ConditionOutcome
				.noMatch(message.didNotFind("A ConfigurableEnvironment").atAll());
	}
	if (hasOAuthClientId(environment)) {
		return ConditionOutcome.match(message.foundExactly("client-id property"));
	}
	Binder binder = Binder.get(environment);
	String prefix = "security.oauth2.resource.";
	if (binder.bind(prefix + "jwt", STRING_OBJECT_MAP).isBound()) {
		return ConditionOutcome
				.match(message.foundExactly("JWT resource configuration"));
	}
	if (binder.bind(prefix + "jwk", STRING_OBJECT_MAP).isBound()) {
		return ConditionOutcome
				.match(message.foundExactly("JWK resource configuration"));
	}
	if (StringUtils.hasText(environment.getProperty(prefix + "user-info-uri"))) {
		return ConditionOutcome
				.match(message.foundExactly("user-info-uri property"));
	}
	if (StringUtils.hasText(environment.getProperty(prefix + "token-info-uri"))) {
		return ConditionOutcome
				.match(message.foundExactly("token-info-uri property"));
	}
	if (ClassUtils.isPresent(AUTHORIZATION_ANNOTATION, null)) {
		if (AuthorizationServerEndpointsConfigurationBeanCondition
				.matches(context)) {
			return ConditionOutcome.match(
					message.found("class").items(AUTHORIZATION_ANNOTATION));
		}
	}
	return ConditionOutcome.noMatch(
			message.didNotFind("client ID, JWT resource or authorization server")
					.atAll());
}
 
开发者ID:spring-projects,项目名称:spring-security-oauth2-boot,代码行数:43,代码来源:OAuth2ResourceServerConfiguration.java


注:本文中的org.springframework.boot.autoconfigure.condition.ConditionMessage.Builder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。