Allow overriding encrypted properties with unencrypted properties (#459)

This commit is contained in:
Jasper Aarts
2018-12-22 07:05:57 +11:00
committed by Ryan Baxter
parent 0821e2b1cd
commit 4a66435d38
2 changed files with 15 additions and 1 deletions

View File

@@ -75,6 +75,17 @@ public class EnvironmentDecryptApplicationInitializerTests {
assertEquals("spam", context.getEnvironment().getProperty("foo"));
}
@Test
public void propertySourcesOrderedCorrectlyWithUnencryptedOverrides() {
ConfigurableApplicationContext context = new AnnotationConfigApplicationContext();
TestPropertyValues.of("foo: {cipher}bar").applyTo(context);
context.getEnvironment().getPropertySources()
.addFirst(new MapPropertySource("test_override",
Collections.<String, Object>singletonMap("foo", "spam")));
this.listener.initialize(context);
assertEquals("spam", context.getEnvironment().getProperty("foo"));
}
@Test(expected = IllegalStateException.class)
public void errorOnDecrypt() {
this.listener = new EnvironmentDecryptApplicationInitializer(