/** * Resolves the value configured for the given key. * * @param key the property key * @param evaluateVariables whether to evaluate any '${variablename}' variable expressions * * @return the configured property value from the {@link ConfigSource} with the highest ordinal or null if there is * no configured value for it */ public static String getPropertyValue(String key, boolean evaluateVariables) { return getConfigProvider().getConfig().resolve(key) .evaluateVariables(evaluateVariables) .withCurrentProjectStage(false) .getValue(); }
/** * Resolves the value configured for the given key. * * @param key the property key * @param evaluateVariables whether to evaluate any '${variablename}' variable expressions * * @return the configured property value from the {@link ConfigSource} with the highest ordinal or null if there is * no configured value for it */ public static String getPropertyValue(String key, boolean evaluateVariables) { return getConfigProvider().getConfig().resolve(key) .evaluateVariables(evaluateVariables) .withCurrentProjectStage(false) .getValue(); }
/** * Resolves the value configured for the given key. * * @param key the property key * * @return the configured property value from the {@link ConfigSource} with the highest ordinal or null if there is * no configured value for it */ public static String getPropertyValue(String key) { return getConfigProvider().getConfig().resolve(key) .evaluateVariables(true) .withCurrentProjectStage(false) .getValue(); }
/** * Resolves the value configured for the given key. * * @param key the property key * * @return the configured property value from the {@link ConfigSource} with the highest ordinal or null if there is * no configured value for it */ public static String getPropertyValue(String key) { return getConfigProvider().getConfig().resolve(key) .evaluateVariables(true) .withCurrentProjectStage(false) .getValue(); }
@Test public void testConfigVariableRecursiveDeclaration() { String url = ConfigResolver.getPropertyValue("deltaspike.test.recursive.variable1", "", true); Assert.assertEquals("pre-crazy-post/ohgosh/crazy", url); ConfigResolver.TypedResolver<String> tr = ConfigResolver.resolve("deltaspike.test.recursive.variable1") .evaluateVariables(true).logChanges(true); Assert.assertEquals("pre-crazy-post/ohgosh/crazy", tr.getValue()); }