use of org.springframework.boot.bind.RelaxedPropertyResolver in project spring-boot by spring-projects.
the class SpringBootTestContextBootstrapper method getConfiguredWebApplicationType.
private WebApplicationType getConfiguredWebApplicationType(MergedContextConfiguration configuration) {
PropertySources sources = convertToPropertySources(configuration.getPropertySourceProperties());
RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(new PropertySourcesPropertyResolver(sources), "spring.main.");
String property = resolver.getProperty("web-application-type");
return (property != null ? WebApplicationType.valueOf(property.toUpperCase()) : null);
}
use of org.springframework.boot.bind.RelaxedPropertyResolver in project spring-boot by spring-projects.
the class SpringPropertyAction method getValue.
private String getValue(String source, String defaultValue) {
if (this.environment == null) {
addWarn("No Spring Environment available to resolve " + source);
return defaultValue;
}
String value = this.environment.getProperty(source);
if (value != null) {
return value;
}
int lastDot = source.lastIndexOf(".");
if (lastDot > 0) {
String prefix = source.substring(0, lastDot + 1);
RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(this.environment, prefix);
return resolver.getProperty(source.substring(lastDot + 1), defaultValue);
}
return defaultValue;
}
use of org.springframework.boot.bind.RelaxedPropertyResolver in project spring-boot by spring-projects.
the class LoggingSystemProperties method apply.
public void apply(LogFile logFile) {
RelaxedPropertyResolver propertyResolver = RelaxedPropertyResolver.ignoringUnresolvableNestedPlaceholders(this.environment, "logging.");
setSystemProperty(propertyResolver, EXCEPTION_CONVERSION_WORD, "exception-conversion-word");
setSystemProperty(propertyResolver, CONSOLE_LOG_PATTERN, "pattern.console");
setSystemProperty(propertyResolver, FILE_LOG_PATTERN, "pattern.file");
setSystemProperty(propertyResolver, LOG_LEVEL_PATTERN, "pattern.level");
setSystemProperty(PID_KEY, new ApplicationPid().toString());
if (logFile != null) {
logFile.applyToSystemProperties();
}
}
use of org.springframework.boot.bind.RelaxedPropertyResolver in project spring-boot by spring-projects.
the class LocalDebugPortAvailableCondition method getMatchOutcome.
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) {
ConditionMessage.Builder message = ConditionMessage.forCondition("Local Debug Port Condition");
RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(context.getEnvironment(), "spring.devtools.remote.debug.");
Integer port = resolver.getProperty("local-port", Integer.class);
if (port == null) {
port = RemoteDevToolsProperties.Debug.DEFAULT_LOCAL_PORT;
}
if (isPortAvailable(port)) {
return ConditionOutcome.match(message.foundExactly("local debug port"));
}
return ConditionOutcome.noMatch(message.didNotFind("local debug port").atAll());
}
use of org.springframework.boot.bind.RelaxedPropertyResolver in project spring-boot by spring-projects.
the class SpringBootContextLoader method hasCustomServerPort.
private boolean hasCustomServerPort(List<String> properties) {
PropertySources sources = convertToPropertySources(properties);
RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(new PropertySourcesPropertyResolver(sources), "server.");
return resolver.containsProperty("port");
}
Aggregations