本文整理汇总了Java中org.springframework.boot.bind.RelaxedPropertyResolver.containsProperty方法的典型用法代码示例。如果您正苦于以下问题:Java RelaxedPropertyResolver.containsProperty方法的具体用法?Java RelaxedPropertyResolver.containsProperty怎么用?Java RelaxedPropertyResolver.containsProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.boot.bind.RelaxedPropertyResolver
的用法示例。
在下文中一共展示了RelaxedPropertyResolver.containsProperty方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getMatchOutcome
import org.springframework.boot.bind.RelaxedPropertyResolver; //导入方法依赖的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();
}
示例2: onApplicationEvent
import org.springframework.boot.bind.RelaxedPropertyResolver; //导入方法依赖的package包/类
@Override
public void onApplicationEvent(ApplicationEnvironmentPreparedEvent event) {
RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(
event.getEnvironment(), "spring.");
if (resolver.containsProperty("mandatoryFileEncoding")) {
String encoding = System.getProperty("file.encoding");
String desired = resolver.getProperty("mandatoryFileEncoding");
if (encoding != null && !desired.equalsIgnoreCase(encoding)) {
logger.error("System property 'file.encoding' is currently '" + encoding
+ "'. It should be '" + desired
+ "' (as defined in 'spring.mandatoryFileEncoding').");
logger.error("Environment variable LANG is '" + System.getenv("LANG")
+ "'. You could use a locale setting that matches encoding='"
+ desired + "'.");
logger.error("Environment variable LC_ALL is '" + System.getenv("LC_ALL")
+ "'. You could use a locale setting that matches encoding='"
+ desired + "'.");
throw new IllegalStateException(
"The Java Virtual Machine has not been configured to use the "
+ "desired default character encoding (" + desired
+ ").");
}
}
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:25,代码来源:FileEncodingApplicationListener.java
示例3: getMatchOutcome
import org.springframework.boot.bind.RelaxedPropertyResolver; //导入方法依赖的package包/类
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context,
AnnotatedTypeMetadata metadata) {
RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(
context.getEnvironment(), "spring.session.");
StoreType sessionStoreType = SessionStoreMappings
.getType(((AnnotationMetadata) metadata).getClassName());
if (!resolver.containsProperty("store-type")) {
if (sessionStoreType == StoreType.REDIS && redisPresent) {
return ConditionOutcome
.match("Session store type default to redis (deprecated)");
}
return ConditionOutcome.noMatch("Session store type not set");
}
String value = resolver.getProperty("store-type").replace("-", "_").toUpperCase();
if (value.equals(sessionStoreType.name())) {
return ConditionOutcome.match("Session store type " + sessionStoreType);
}
return ConditionOutcome.noMatch("Session store type " + value);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:21,代码来源:SessionCondition.java
示例4: getMatchOutcome
import org.springframework.boot.bind.RelaxedPropertyResolver; //导入方法依赖的package包/类
@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);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:17,代码来源:CacheCondition.java
示例5: getMatchOutcome
import org.springframework.boot.bind.RelaxedPropertyResolver; //导入方法依赖的package包/类
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context,
AnnotatedTypeMetadata metadata) {
RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(
context.getEnvironment(), "spring.cache.jcache.");
if (resolver.containsProperty("provider")) {
return ConditionOutcome.match("JCache provider specified");
}
Iterator<CachingProvider> providers = Caching.getCachingProviders()
.iterator();
if (!providers.hasNext()) {
return ConditionOutcome.noMatch("No JSR-107 compliant providers");
}
providers.next();
if (providers.hasNext()) {
return ConditionOutcome.noMatch(
"Multiple default JSR-107 compliant " + "providers found");
}
return ConditionOutcome.match("Default JSR-107 compliant provider found.");
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:22,代码来源:JCacheCacheConfiguration.java
示例6: onApplicationEvent
import org.springframework.boot.bind.RelaxedPropertyResolver; //导入方法依赖的package包/类
@Override
public void onApplicationEvent(ApplicationEnvironmentPreparedEvent event) {
RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(
event.getEnvironment(), "spring.output.ansi.");
if (resolver.containsProperty("enabled")) {
String enabled = resolver.getProperty("enabled");
AnsiOutput.setEnabled(Enum.valueOf(Enabled.class, enabled.toUpperCase()));
}
if (resolver.containsProperty("console-available")) {
AnsiOutput.setConsoleAvailable(
resolver.getProperty("console-available", Boolean.class));
}
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:15,代码来源:AnsiOutputApplicationListener.java
示例7: getEndpointOutcome
import org.springframework.boot.bind.RelaxedPropertyResolver; //导入方法依赖的package包/类
protected ConditionOutcome getEndpointOutcome(ConditionContext context,
String endpointName) {
RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(
context.getEnvironment(), this.prefix + endpointName + ".");
if (resolver.containsProperty("enabled")) {
boolean match = resolver.getProperty("enabled", Boolean.class, true);
return new ConditionOutcome(match,
getEndpointElementOutcomeMessage(endpointName, match));
}
return null;
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:12,代码来源:OnEnabledEndpointElementCondition.java
示例8: determineEndpointOutcome
import org.springframework.boot.bind.RelaxedPropertyResolver; //导入方法依赖的package包/类
private ConditionOutcome determineEndpointOutcome(String endpointName,
boolean enabledByDefault, ConditionContext context) {
RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(
context.getEnvironment(), "endpoints." + endpointName + ".");
if (resolver.containsProperty("enabled") || !enabledByDefault) {
boolean match = resolver.getProperty("enabled", Boolean.class,
enabledByDefault);
return new ConditionOutcome(match, "The endpoint " + endpointName + " is "
+ (match ? "enabled" : "disabled"));
}
return null;
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:13,代码来源:OnEnabledEndpointCondition.java
示例9: getMatchOutcome
import org.springframework.boot.bind.RelaxedPropertyResolver; //导入方法依赖的package包/类
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context,
AnnotatedTypeMetadata metadata) {
RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(
context.getEnvironment(), this.prefix);
if (resolver.containsProperty(this.propertyName)) {
return ConditionOutcome.match("A '" + this.prefix + this.propertyName + "' "
+ "property is specified");
}
return getResourceOutcome(context, metadata);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:12,代码来源:ResourceCondition.java