use of org.springframework.core.env.EnumerablePropertySource in project grails-core by grails.
the class PropertySourcesConfig method initializeFromPropertySources.
protected void initializeFromPropertySources(PropertySources propertySources) {
EnvironmentAwarePropertySource environmentAwarePropertySource = new EnvironmentAwarePropertySource(propertySources);
if (propertySources instanceof MutablePropertySources) {
final String applicationConfig = "applicationConfigurationProperties";
if (propertySources.contains(applicationConfig)) {
((MutablePropertySources) propertySources).addBefore(applicationConfig, environmentAwarePropertySource);
} else {
((MutablePropertySources) propertySources).addLast(environmentAwarePropertySource);
}
}
List<PropertySource<?>> propertySourceList = DefaultGroovyMethods.toList(propertySources);
Collections.reverse(propertySourceList);
for (PropertySource propertySource : propertySourceList) {
if (propertySource instanceof EnumerablePropertySource) {
EnumerablePropertySource enumerablePropertySource = (EnumerablePropertySource) propertySource;
mergeEnumerablePropertySource(enumerablePropertySource);
}
}
}
use of org.springframework.core.env.EnumerablePropertySource in project kork by spinnaker.
the class SecretAwarePropertySourceTest method setup.
@Before
public void setup() {
EnumerablePropertySource source = new EnumerablePropertySource("testSource") {
@Override
public String[] getPropertyNames() {
return new String[0];
}
@Override
public Object getProperty(String name) {
return testValues.get(name);
}
};
testValues.put("testSecretFile", "encrypted:noop!k:testValue");
testValues.put("testSecretPath", "encrypted:noop!k:testValue");
testValues.put("testSecretCert", "encryptedFile:noop!k:testValue");
testValues.put("testSecretString", "encrypted:noop!k:testValue");
testValues.put("testNotSoSecret", "unencrypted");
secretManager = mock(SecretManager.class);
secretAwarePropertySource = new SecretAwarePropertySource(source, secretManager);
when(secretManager.decryptAsFile(any())).thenReturn(Paths.get("decryptedFile"));
when(secretManager.decrypt(any())).thenReturn("decryptedString");
}
Aggregations