Skip to content

Short circuit @Value injection when using a source already covered by ConfigurationPropertySourcesPropertySource #28687

Closed as not planned
@ShijunDeng

Description

@ShijunDeng

class ConfigurationPropertySourcesPropertySource extends PropertySource<Iterable<ConfigurationPropertySource>>

In Springboot application,ConfigurationPropertySourcesPropertySource is added to the environment and as first element, the ConfigurationPropertySourcesPropertySource acts as a facade over the existing property sources.

When handling @Value annotation, org.springframework.core.env.PropertySourcesPropertyResolver#getProperty will be called.
If the property is found then ConfigurationPropertySourcesPropertySource will return the result. otherwise, PropertySourcesPropertyResolver continues to check all subsequent sources. This is a little inefficient for any source that has already been check via ConfigurationPropertySourcesPropertySource.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions