Skip to content
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 #34764

Closed

Conversation

krzyk
Copy link
Contributor

@krzyk krzyk commented Mar 25, 2023

For #34713.
Fixed support for default value placeholders in banner.
I had to change the way they are handled - replace PropertyResolvers with PropertySources (and add a custom one/anonymous one for Environment).

Added two tests to make sure it really fixed the problem and didn't break in case of missing values.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Mar 25, 2023
@wilkinsona wilkinsona added this to the 2.7.x milestone Mar 28, 2023
@wilkinsona wilkinsona added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Mar 28, 2023
@wilkinsona wilkinsona changed the title #34713 Fix support for default values in banner placeholders Banner placeholders use default values too soon Mar 28, 2023
@wilkinsona wilkinsona modified the milestones: 2.7.x, 2.7.11 Mar 28, 2023
@wilkinsona
Copy link
Member

Thanks very much, @krzyk.

propertySources.addLast(getTitleSource(sourceClass));
propertySources.addLast(getAnsiSource());
propertySources.addLast(getVersionSource(sourceClass));
return Collections.singletonList(new PropertySourcesPropertyResolver(propertySources));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wilkinsona Using singletonList here changed the behavior of this method by making the returned list unmodifiable. Was this intentional?

For ResourceBanner subclasses, the change to use an unmodifiable list introduced a breaking change. We were able to work around it by creating a new list, adding items from this list, along with our own PropertyResolver(s).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good spot. I've fixed that in a707c5e

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @edwardsre. I missed that when reviewing the changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants