Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New @Config.Prefix annotation. #273

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Gmugra
Copy link

@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

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