use of org.springframework.boot.env.PropertySourceLoader in project cloudbreak by hortonworks.
the class AppConfig method init.
@PostConstruct
public void init() throws IOException {
Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
ResourcePatternResolver patternResolver = new PathMatchingResourcePatternResolver();
PropertySourceLoader load = new YamlPropertySourceLoader();
for (Resource resource : patternResolver.getResources("classpath*:*-images.yml")) {
environment.getPropertySources().addLast(load.load(resource.getFilename(), resource, null));
}
for (Resource resource : loadEtcResources()) {
environment.getPropertySources().addFirst(load.load(resource.getFilename(), resource, null));
}
}
use of org.springframework.boot.env.PropertySourceLoader in project spring-boot by spring-projects.
the class StandardConfigDataLocationResolver method getReferencesForFile.
private Set<StandardConfigDataReference> getReferencesForFile(ConfigDataLocation configDataLocation, String file, String profile) {
Matcher extensionHintMatcher = EXTENSION_HINT_PATTERN.matcher(file);
boolean extensionHintLocation = extensionHintMatcher.matches();
if (extensionHintLocation) {
file = extensionHintMatcher.group(1) + extensionHintMatcher.group(2);
}
for (PropertySourceLoader propertySourceLoader : this.propertySourceLoaders) {
String extension = getLoadableFileExtension(propertySourceLoader, file);
if (extension != null) {
String root = file.substring(0, file.length() - extension.length() - 1);
StandardConfigDataReference reference = new StandardConfigDataReference(configDataLocation, null, root, profile, (!extensionHintLocation) ? extension : null, propertySourceLoader);
return Collections.singleton(reference);
}
}
throw new IllegalStateException("File extension is not known to any PropertySourceLoader. " + "If the location is meant to reference a directory, it must end in '/' or File.separator");
}
Aggregations