-
Notifications
You must be signed in to change notification settings - Fork 38.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow resolving nested placeholders if value is not String
but CharSequence
#32876
Conversation
Ironically enough, that broke the use case in the linked issue as anything that implements Reverting. |
This was reverted in 94348d9 |
Could you elaborate what is broken? |
You could try your change against the change you've made in Spring Boot and you'll see by yourself. |
MockPropertySource propertySource = new MockPropertySource();
propertySource.withProperty("v1", "1");
propertySource.withProperty("v2", new CharSequence() {
static final String underlying = "${v1}";
@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;
}
});
environment.getPropertySources().addFirst(propertySource);
assertThat(environment.getProperty("v2")).isEqualTo("1");
assertThat(environment.getProperty("v2", Integer.class)).isOne(); The |
You're missing the point, it's the other way around. |
I'm aware of that, I don't think application would rely on type |
@snicoll Please see spring-projects/spring-boot#40862 (comment), I will submit another PR if that fix is acceptable. |
chatting with @wilkinsona, we can reconsider this by looking for the target type as well. |
See spring-projects/spring-boot#34195