Skip to content

Banner placeholders use default values too soon #34713

Closed as not planned
Closed as not planned
@Saucistophe

Description

@Saucistophe

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 becomes dev 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:

for (PropertyResolver resolver : getPropertyResolvers(environment, sourceClass)) {
    banner = resolver.resolvePlaceholders(banner);
}

If the first resolver fails to find the value, it outputs the default value and it's final.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions