List of usage examples for org.springframework.beans.factory.config YamlPropertiesFactoryBean setMatchDefault
public void setMatchDefault(boolean matchDefault)
From source file:org.zalando.crypto.spring.boot.EncryptedYamlPropertySourceLoader.java
@Override public PropertySource<?> load(final String name, final Resource resource, final String profile) throws IOException { validateDecrypter();/* w w w. ja va 2 s .c o m*/ if (ClassUtils.isPresent("org.yaml.snakeyaml.Yaml", null)) { YamlPropertiesFactoryBean factory = new YamlPropertiesFactoryBean(); if (profile == null) { factory.setMatchDefault(true); factory.setDocumentMatchers(new SpringProfileDocumentMatcher()); } else { factory.setMatchDefault(false); factory.setDocumentMatchers(new SpringProfileDocumentMatcher(profile)); } factory.setResources(new Resource[] { resource }); Properties properties = factory.getObject(); if (!properties.isEmpty()) { return new PropertiesPropertySource(name, new EncryptableProperties(properties, decrypter, getPrefix())); } } return null; }