Skip to content

Banner placeholders use default values too soon#34764

Closed
krzyk wants to merge 1 commit intospring-projects:2.7.xfrom
krzyk:34713-correct-defaults-in-banner
Closed

Banner placeholders use default values too soon#34764
krzyk wants to merge 1 commit intospring-projects:2.7.xfrom
krzyk:34713-correct-defaults-in-banner

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