本文整理汇总了Java中org.springframework.boot.autoconfigure.condition.ConditionMessage类的典型用法代码示例。如果您正苦于以下问题:Java ConditionMessage类的具体用法?Java ConditionMessage怎么用?Java ConditionMessage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ConditionMessage类属于org.springframework.boot.autoconfigure.condition包,在下文中一共展示了ConditionMessage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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());
}
示例3: getMatchOutcome
import org.springframework.boot.autoconfigure.condition.ConditionMessage; //导入依赖的package包/类
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) {
final RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(context.getEnvironment(),
"holon.swagger.");
if (!resolver.getProperty("holon.swagger.enabled", boolean.class, true)) {
return ConditionOutcome.noMatch(ConditionMessage.forCondition("SwaggerApiAutoDetectCondition")
.because("holon.swagger.enabled is false"));
}
if (resolver.containsProperty("resourcePackage")) {
return ConditionOutcome.noMatch(
ConditionMessage.forCondition("SwaggerApiAutoDetectCondition").available("resourcePackage"));
}
Map<String, Object> ag = resolver.getSubProperties("apiGroups");
if (ag != null && ag.size() > 0) {
return ConditionOutcome
.noMatch(ConditionMessage.forCondition("SwaggerApiAutoDetectCondition").available("apiGroups"));
}
return ConditionOutcome.match();
}
示例4: 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));
}
示例5: getMatchOutcome
import org.springframework.boot.autoconfigure.condition.ConditionMessage; //导入依赖的package包/类
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) {
Map<String, Object> attributes = metadata.getAnnotationAttributes(ConditionalOnPropertyPrefix.class.getName());
if (attributes.containsKey("value")) {
String prefix = (String) attributes.get("value");
if (prefix != null && !prefix.trim().equals("")) {
final String propertyPrefix = !prefix.endsWith(".") ? prefix + "." : prefix;
ConfigPropertyProvider configPropertyProvider = EnvironmentConfigPropertyProvider
.create(context.getEnvironment());
Set<String> names = configPropertyProvider.getPropertyNames()
.filter((n) -> n.startsWith(propertyPrefix)).collect(Collectors.toSet());
if (!names.isEmpty()) {
return ConditionOutcome.match();
}
return ConditionOutcome.noMatch(
ConditionMessage.forCondition(ConditionalOnPropertyPrefix.class).notAvailable(propertyPrefix));
}
}
return ConditionOutcome.match();
}
示例6: 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"));
}
示例7: 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
示例8: 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
示例9: getMatchOutcome
import org.springframework.boot.autoconfigure.condition.ConditionMessage; //导入依赖的package包/类
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) {
AnnotationAttributes attributes = AnnotationAttributes
.fromMap(metadata.getAnnotationAttributes(ConditionalOnEnabledDetector.class.getName()));
final String name = attributes.getString("value");
final String prefix = attributes.getString("prefix");
RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(context.getEnvironment(),
prefix + "." + name + ".");
Boolean enabled = resolver.getProperty("enabled", Boolean.class, true);
return new ConditionOutcome(enabled, ConditionMessage.forCondition(ConditionalOnEnabledDetector.class, name)
.because(enabled ? "enabled" : "disabled"));
}
示例10: 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());
}
示例11: 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"));
}
示例12: 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"));
}
}
示例13: getMatchOutcome
import org.springframework.boot.autoconfigure.condition.ConditionMessage; //导入依赖的package包/类
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) {
ConditionMessage matchMessage = ConditionMessage.empty();
boolean enabled = isSpringSecurityEnabled(context);
if (metadata.isAnnotated(ConditionalOnJuiserSpringSecurityEnabled.class.getName())) {
if (!enabled) {
return ConditionOutcome.noMatch(
ConditionMessage.forCondition(ConditionalOnJuiserSpringSecurityEnabled.class)
.didNotFind("spring security enabled").atAll());
}
matchMessage = matchMessage.andCondition(ConditionalOnJuiserSpringSecurityEnabled.class)
.foundExactly("spring security enabled");
}
if (metadata.isAnnotated(ConditionalOnJuiserSpringSecurityDisabled.class.getName())) {
if (enabled) {
return ConditionOutcome.noMatch(
ConditionMessage.forCondition(ConditionalOnJuiserSpringSecurityDisabled.class)
.didNotFind("spring security disabled").atAll());
}
matchMessage = matchMessage.andCondition(ConditionalOnJuiserSpringSecurityDisabled.class)
.didNotFind("spring security disabled").atAll();
}
return ConditionOutcome.match(matchMessage);
}
示例14: 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"));
}
示例15: 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