Polish "Extend nested placeholders resolution to any CharSequence"
See gh-32876
This commit is contained in:
parent
5a7bfa9dec
commit
79b5ee75d3
|
|
@ -24,7 +24,6 @@ import org.springframework.lang.Nullable;
|
||||||
*
|
*
|
||||||
* @author Chris Beams
|
* @author Chris Beams
|
||||||
* @author Juergen Hoeller
|
* @author Juergen Hoeller
|
||||||
* @author Yanming Zhou
|
|
||||||
* @since 3.1
|
* @since 3.1
|
||||||
* @see PropertySource
|
* @see PropertySource
|
||||||
* @see PropertySources
|
* @see PropertySources
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,6 @@ import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Chris Beams
|
* @author Chris Beams
|
||||||
* @author Yanming Zhou
|
|
||||||
* @since 3.1
|
* @since 3.1
|
||||||
*/
|
*/
|
||||||
class PropertySourcesPropertyResolverTests {
|
class PropertySourcesPropertyResolverTests {
|
||||||
|
|
@ -307,31 +306,7 @@ class PropertySourcesPropertyResolverTests {
|
||||||
ps.addFirst(new MockPropertySource()
|
ps.addFirst(new MockPropertySource()
|
||||||
.withProperty("p1", "v1")
|
.withProperty("p1", "v1")
|
||||||
.withProperty("p2", "v2")
|
.withProperty("p2", "v2")
|
||||||
.withProperty("p3", new CharSequence() {
|
.withProperty("p3", new StringBuilder("${p1}:${p2}")));
|
||||||
|
|
||||||
static final String underlying = "${p1}:${p2}";
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int length() {
|
|
||||||
return underlying.length();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public char charAt(int index) {
|
|
||||||
return underlying.charAt(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public CharSequence subSequence(int start, int end) {
|
|
||||||
return underlying.subSequence(start, end);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return underlying;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
);
|
|
||||||
ConfigurablePropertyResolver pr = new PropertySourcesPropertyResolver(ps);
|
ConfigurablePropertyResolver pr = new PropertySourcesPropertyResolver(ps);
|
||||||
assertThat(pr.getProperty("p1")).isEqualTo("v1");
|
assertThat(pr.getProperty("p1")).isEqualTo("v1");
|
||||||
assertThat(pr.getProperty("p2")).isEqualTo("v2");
|
assertThat(pr.getProperty("p2")).isEqualTo("v2");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue