use of cn.taketoday.core.env.PropertySourcesPropertyResolver in project today-infrastructure by TAKETODAY.
the class ConfigurationPropertySourcesTests method attachShouldAddAdapterAtBeginning.
@Test
void attachShouldAddAdapterAtBeginning() {
ConfigurableEnvironment environment = new StandardEnvironment();
PropertySources sources = environment.getPropertySources();
sources.addLast(new SystemEnvironmentPropertySource("system", Collections.singletonMap("SERVER_PORT", "1234")));
sources.addLast(new MapPropertySource("config", Collections.singletonMap("server.port", "4568")));
int size = sources.size();
ConfigurationPropertySources.attach(environment);
assertThat(sources.size()).isEqualTo(size + 1);
PropertyResolver resolver = new PropertySourcesPropertyResolver(sources);
assertThat(resolver.getProperty("server.port")).isEqualTo("1234");
}
use of cn.taketoday.core.env.PropertySourcesPropertyResolver in project today-infrastructure by TAKETODAY.
the class ResourceBanner method getTitleResolver.
private PropertyResolver getTitleResolver(Class<?> sourceClass) {
PropertySources sources = new PropertySources();
String applicationTitle = getApplicationTitle(sourceClass);
Map<String, Object> titleMap = Collections.singletonMap("application.title", (applicationTitle != null) ? applicationTitle : "");
sources.addFirst(new MapPropertySource("title", titleMap));
return new PropertySourcesPropertyResolver(sources);
}
use of cn.taketoday.core.env.PropertySourcesPropertyResolver in project today-infrastructure by TAKETODAY.
the class ResourceBanner method getAnsiResolver.
private PropertyResolver getAnsiResolver() {
PropertySources sources = new PropertySources();
sources.addFirst(new AnsiPropertySource("ansi", true));
return new PropertySourcesPropertyResolver(sources);
}
use of cn.taketoday.core.env.PropertySourcesPropertyResolver in project today-framework by TAKETODAY.
the class ResourceBanner method getVersionResolver.
private PropertyResolver getVersionResolver(Class<?> sourceClass) {
PropertySources propertySources = new PropertySources();
propertySources.addLast(new MapPropertySource("version", getVersionsMap(sourceClass)));
return new PropertySourcesPropertyResolver(propertySources);
}
use of cn.taketoday.core.env.PropertySourcesPropertyResolver in project today-framework by TAKETODAY.
the class ResourceBanner method getAnsiResolver.
private PropertyResolver getAnsiResolver() {
PropertySources sources = new PropertySources();
sources.addFirst(new AnsiPropertySource("ansi", true));
return new PropertySourcesPropertyResolver(sources);
}
Aggregations