-
Notifications
You must be signed in to change notification settings - Fork 40.7k
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
Banner placeholders use default values too soon #34713
Labels
Comments
spring-projects-issues
added
the
status: waiting-for-triage
An issue we've not yet triaged
label
Mar 22, 2023
philwebb
added
type: bug
A general bug
status: ideal-for-contribution
An issue that a contributor can help us with
and removed
status: waiting-for-triage
An issue we've not yet triaged
labels
Mar 22, 2023
@philwebb Can I work on this one? |
It's all yours, @krzyk. Thank you. |
If that can help, here is the test I wrote: @Test
void renderDefaultValues() {
Resource resource = new ByteArrayResource(
"banner ${a}${spring-boot.formatted-version:default-value}".getBytes());
String banner = printBanner(resource, "10.2", "2.0", null);
assertThat(banner).startsWith("banner 1 (v10.2)");
} ..Which yields:
|
krzyk
added a commit
to krzyk/spring-boot
that referenced
this issue
Mar 25, 2023
wilkinsona
changed the title
Banner placeholders do not support default values
Banner placeholders use default values too soon
Mar 28, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
The
ResourceBanner
uses placeholders with the regular syntax${variable.name}
syntax.There are only a few variables supported, which is fine; and some of them, such as the application version, is not resolved when starting the project from IDE (as opposed from the jar).
I wanted to use default values, for instance
${application.version:dev}
; when I do that, the printed version becomesdev
regardless of whether it's defined.I reproduced the issue in unit tests in
ResourceBannerTests
, and I think it is due to the way we handle resolvers:If the first resolver fails to find the value, it outputs the default value and it's final.
The text was updated successfully, but these errors were encountered: