|
|
|
@ -147,7 +147,7 @@ public class EnvironmentMvcEndpointTests {
|
|
|
|
|
map.put("my.foo", "${my.bar}");
|
|
|
|
|
((ConfigurableEnvironment) this.context.getEnvironment()).getPropertySources()
|
|
|
|
|
.addFirst(new MapPropertySource("unresolved-placeholder", map));
|
|
|
|
|
this.mvc.perform(get("/env/my.*")).andExpect(status().isOk())
|
|
|
|
|
this.mvc.perform(get("/env/my.foo")).andExpect(status().isOk())
|
|
|
|
|
.andExpect(content().string(containsString("\"my.foo\":\"${my.bar}\"")));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -156,6 +156,29 @@ public class EnvironmentMvcEndpointTests {
|
|
|
|
|
Map<String, Object> map = new HashMap<String, Object>();
|
|
|
|
|
map.put("my.foo", "${my.password}");
|
|
|
|
|
map.put("my.password", "hello");
|
|
|
|
|
((ConfigurableEnvironment) this.context.getEnvironment()).getPropertySources()
|
|
|
|
|
.addFirst(new MapPropertySource("placeholder", map));
|
|
|
|
|
this.mvc.perform(get("/env/my.foo")).andExpect(status().isOk())
|
|
|
|
|
.andExpect(content().string(containsString("\"my.foo\":\"******\"")));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void nestedPathMatchedByRegexWhenPlaceholderCannotBeResolvedShouldReturnUnresolvedProperty()
|
|
|
|
|
throws Exception {
|
|
|
|
|
Map<String, Object> map = new HashMap<String, Object>();
|
|
|
|
|
map.put("my.foo", "${my.bar}");
|
|
|
|
|
((ConfigurableEnvironment) this.context.getEnvironment()).getPropertySources()
|
|
|
|
|
.addFirst(new MapPropertySource("unresolved-placeholder", map));
|
|
|
|
|
this.mvc.perform(get("/env/my.*")).andExpect(status().isOk())
|
|
|
|
|
.andExpect(content().string(containsString("\"my.foo\":\"${my.bar}\"")));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void nestedPathMatchedByRegexWithSensitivePlaceholderShouldSanitize()
|
|
|
|
|
throws Exception {
|
|
|
|
|
Map<String, Object> map = new HashMap<String, Object>();
|
|
|
|
|
map.put("my.foo", "${my.password}");
|
|
|
|
|
map.put("my.password", "hello");
|
|
|
|
|
((ConfigurableEnvironment) this.context.getEnvironment()).getPropertySources()
|
|
|
|
|
.addFirst(new MapPropertySource("placeholder", map));
|
|
|
|
|
this.mvc.perform(get("/env/my.*")).andExpect(status().isOk())
|
|
|
|
|