Skip to content

Reduce reflection and annotation usage in ConfigData infrastructure #23221

Closed
@dsyer

Description

@dsyer

I hope there are many places we can improve this. Let's start with a simple one.

ConfigDataProperties is a value object, and is constructed reflectively via Binder.bind() which is wasteful. As far as I can tell it is only ever used to look up the value of spring.config.import (the env var upper case version is never used because it would be bound already to the "initial" imports). And "import" doesn't have any kebab case variants, so you don't need a Binder. I think we can simply look in the Environment and if the property is there construct a ConfigDataProperties instance directly by calling the constructor or a factor method.

It also uses an annotation @Name to rename the property bound to its constructor, which also seems unnecessarily indirect (we control both the property name and the constructor source code). We probably can't get rid of the annotation processing if we need to use Binder.bind(), but if we can skip that then even better.

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: supersededAn issue that has been superseded by another

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions