Skip to content

New @Config.Prefix annotation.#273

Open
Gmugra wants to merge 1 commit intomatteobaccan:masterfrom
Gmugra:issue_259_prefix
Open

New @Config.Prefix annotation.#273
Gmugra wants to merge 1 commit intomatteobaccan:masterfrom
Gmugra:issue_259_prefix

Conversation

@Gmugra
Copy link
Copy Markdown

@Gmugra Gmugra commented Dec 13, 2020

This is solution for #259

With new @Prefix annotation you can set prifix for all properties in the Config interface,
which helps to avoid @key annotations.

Was:

public interface ExpandsFromAnotherKey extends Config {

    @DefaultValue("dev")
    String env();

    @Key("servers.${env}.name")
    String name();

    @Key("servers.${env}.super.hostname")
    String hostname();

    @Key("servers.${env}.port")
    Integer port();

    @Key("servers.${env}.user")
    String user();

    @DisableFeature(VARIABLE_EXPANSION)
    @Key("servers.${env}.password")
    String password();
}

Now:

@Prefix("servers.${env}.")
public interface ExpandsFromAnotherKey extends Config {

    @DisableFeature(PREFIX)
    @DefaultValue("dev")
    String env();

    String name();

    @Key("super.hostname")
    String hostname();

    Integer port();

    String user();

    @DisableFeature(VARIABLE_EXPANSION)
    String password();
}

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.1%) to 93.072% when pulling fb9db08 on Gmugra:issue_259_prefix into cc20db1 on lviggiano:master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants