use of org.springframework.core.env.MapPropertySource in project spring-boot by spring-projects.
the class EnvironmentTestUtils method getOrAdd.
@SuppressWarnings("unchecked")
private static Map<String, Object> getOrAdd(MutablePropertySources sources, String name) {
if (sources.contains(name)) {
return (Map<String, Object>) sources.get(name).getSource();
}
Map<String, Object> map = new HashMap<>();
sources.addFirst(new MapPropertySource(name, map));
return map;
}
use of org.springframework.core.env.MapPropertySource in project spring-boot by spring-projects.
the class SpringBootTestContextBootstrapper method convertToPropertySources.
private PropertySources convertToPropertySources(String[] properties) {
Map<String, Object> source = TestPropertySourceUtils.convertInlinedPropertiesToMap(properties);
MutablePropertySources sources = new MutablePropertySources();
sources.addFirst(new MapPropertySource("inline", source));
return sources;
}
use of org.springframework.core.env.MapPropertySource in project spring-boot by spring-projects.
the class ResourceBanner method getTitleResolver.
private PropertyResolver getTitleResolver(Class<?> sourceClass) {
MutablePropertySources sources = new MutablePropertySources();
String applicationTitle = getApplicationTitle(sourceClass);
Map<String, Object> titleMap = Collections.<String, Object>singletonMap("application.title", (applicationTitle == null ? "" : applicationTitle));
sources.addFirst(new MapPropertySource("title", titleMap));
return new PropertySourcesPropertyResolver(sources);
}
use of org.springframework.core.env.MapPropertySource in project spring-boot by spring-projects.
the class ResourceBanner method getVersionResolver.
private PropertyResolver getVersionResolver(Class<?> sourceClass) {
MutablePropertySources propertySources = new MutablePropertySources();
propertySources.addLast(new MapPropertySource("version", getVersionsMap(sourceClass)));
return new PropertySourcesPropertyResolver(propertySources);
}
use of org.springframework.core.env.MapPropertySource in project spring-boot by spring-projects.
the class LogFileTests method getPropertyResolver.
private PropertyResolver getPropertyResolver(String file, String path) {
Map<String, Object> properties = new LinkedHashMap<>();
properties.put("logging.file", file);
properties.put("logging.path", path);
PropertySource<?> propertySource = new MapPropertySource("properties", properties);
MutablePropertySources propertySources = new MutablePropertySources();
propertySources.addFirst(propertySource);
return new PropertySourcesPropertyResolver(propertySources);
}
Aggregations