本文整理匯總了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