Skip to content

Support configuration properties beans in functional bean registration DSL #37747

Open
@cloudshiftchris

Description

@cloudshiftchris

Functional bean registration does not presently provide equivalents for @ConfigurationProperties, @EnableConfigurationProperties.

It would be great to remove all the annotation-indirection and allow users to directly create beans based off of configuration.

For example:

 beans {
    configurationPropertiesBean<SomeBean>(prefix = "my.prefix")
}

Where a minimal implementation of configurationPropertiesBean could look like:

public inline fun <reified T : Any> BeanDefinitionDsl.configurationPropertiesBean(prefix: String) {
    bean {
        Binder.get(env)
            .bindOrCreate(prefix, Bindable.of(T::class.java))
    }
}

This provides capabilities for registering multiple configuration properties beans of the same type, from different prefixes, and/or determining those prefixes dynamically.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions