use of org.springframework.boot.bind.RelaxedPropertyResolver in project spring-boot by spring-projects.
the class OnEnabledEndpointElementCondition method getDefaultEndpointsOutcome.
protected ConditionOutcome getDefaultEndpointsOutcome(ConditionContext context) {
RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(context.getEnvironment(), this.prefix + "defaults.");
boolean match = Boolean.valueOf(resolver.getProperty("enabled", "true"));
return new ConditionOutcome(match, ConditionMessage.forCondition(this.annotationType).because(this.prefix + "defaults.enabled is considered " + match));
}
use of org.springframework.boot.bind.RelaxedPropertyResolver in project spring-boot by spring-projects.
the class MustacheEnvironmentCollector method setEnvironment.
@Override
public void setEnvironment(Environment environment) {
this.environment = (ConfigurableEnvironment) environment;
this.target = new HashMap<>();
new RelaxedDataBinder(this.target).bind(new PropertySourcesPropertyValues(this.environment.getPropertySources()));
this.propertyResolver = new RelaxedPropertyResolver(environment);
}
use of org.springframework.boot.bind.RelaxedPropertyResolver in project spring-boot by spring-projects.
the class ImageBanner method printBanner.
private void printBanner(Environment environment, PrintStream out) throws IOException {
PropertyResolver properties = new RelaxedPropertyResolver(environment, "banner.image.");
int width = properties.getProperty("width", Integer.class, 76);
int height = properties.getProperty("height", Integer.class, 0);
int margin = properties.getProperty("margin", Integer.class, 2);
boolean invert = properties.getProperty("invert", Boolean.class, false);
BufferedImage image = readImage(width, height);
printBanner(image, margin, invert, out);
}
use of org.springframework.boot.bind.RelaxedPropertyResolver in project jetcache by alibaba.
the class AbstractCacheAutoInit method process.
private void process(String prefix, Map cacheBuilders, boolean local) {
RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(applicationContext.getEnvironment(), prefix);
Map<String, Object> m = resolver.getSubProperties("");
Set<String> cacheAreaNames = m.keySet().stream().map((s) -> s.substring(0, s.indexOf('.'))).collect(Collectors.toSet());
for (String cacheArea : cacheAreaNames) {
if (!typeName.equals(m.get(cacheArea + ".type"))) {
continue;
}
RelaxedPropertyResolver r = new RelaxedPropertyResolver(applicationContext.getEnvironment(), prefix + cacheArea + ".");
logger.info("init cache area {} , type= {}", cacheArea, typeName);
CacheBuilder c = initCache(r, local ? "local." + cacheArea : "remote." + cacheArea);
cacheBuilders.put(cacheArea, c);
}
}
Aggregations