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

Converter / Decryptor is not being called when property value is referenced in another property #287

Open
mrunalgosar-tripactions opened this issue Feb 9, 2022 · 0 comments

Comments

@mrunalgosar-tripactions
Copy link

mrunalgosar-tripactions commented Feb 9, 2022

Issue Summary: Converter / Decryptor is not being called when property value is referenced in another property.
Description: Suppose a user refers to a key in another key, then we would expect the source key's converted value to be available in target key instead of original value.
Refer sample test below:

local.properties

key1=random
url=${key1}

UnitTest.java

public class UnitTest {

    @Config.Sources({
            "classpath:local.properties",
            "file:src/test/resources/applications.properties"
    })
    public interface ConfigTest extends Config {

        @Key("key1")
        @ConverterClass(Conv.class)
        String key1();

        @Key("url")
        String url();

        class Conv implements Converter<String> {

            @Override
            public String convert(Method method, String s) {
                return s + " value";
            }
        }
    }

    @Test
    void test() {
        ConfigTest test = ConfigCache.getOrCreate(ConfigTest.class);
        System.out.println("key1 property value -> " + test.key1());
        System.out.println("url property value -> " + test.url());
    }
}

Output:

key1 property value -> random value
url property value -> random <!-- Here we would expect 'random value' instead of just random-->
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

No branches or pull requests

1 participant