public StaticStringValueResolver(final Map<String, String> values) { this.helper = new PropertyPlaceholderHelper("${", "}", ":", false); this.resolver = values::get; }
private PropertyPlaceholderHelper createPlaceholderHelper(boolean ignoreUnresolvablePlaceholders) { return new PropertyPlaceholderHelper(this.placeholderPrefix, this.placeholderSuffix, this.valueSeparator, ignoreUnresolvablePlaceholders); }
private PropertyPlaceholderHelper createPlaceholderHelper(boolean ignoreUnresolvablePlaceholders) { return new PropertyPlaceholderHelper(this.placeholderPrefix, this.placeholderSuffix, this.valueSeparator, ignoreUnresolvablePlaceholders); }
public PropertySourcesPlaceholdersResolver(Iterable<PropertySource<?>> sources, PropertyPlaceholderHelper helper) { this.sources = sources; this.helper = (helper != null) ? helper : new PropertyPlaceholderHelper(SystemPropertyUtils.PLACEHOLDER_PREFIX, SystemPropertyUtils.PLACEHOLDER_SUFFIX, SystemPropertyUtils.VALUE_SEPARATOR, true); }
public PlaceholderResolvingStringValueResolver(Properties props) { this.helper = new PropertyPlaceholderHelper( placeholderPrefix, placeholderSuffix, valueSeparator, ignoreUnresolvablePlaceholders); this.resolver = new PropertyPlaceholderConfigurerResolver(props); }
public PlaceholderResolvingStringValueResolver(Properties props) { this.helper = new PropertyPlaceholderHelper( placeholderPrefix, placeholderSuffix, valueSeparator, ignoreUnresolvablePlaceholders); this.resolver = new PropertyPlaceholderConfigurerResolver(props); }
public PlaceholderResolvingStringValueResolver(Properties props) { this.helper = new PropertyPlaceholderHelper("${", "}", ":", true); this.resolver = new PropertyPlaceholderConfigurerResolver(props); }
@Test(expected = IllegalArgumentException.class) public void testUnresolvedPlaceholderAsError() { String text = "foo=${foo},bar=${bar}"; Properties props = new Properties(); props.setProperty("foo", "bar"); PropertyPlaceholderHelper helper = new PropertyPlaceholderHelper("${", "}", null, false); assertEquals("foo=bar,bar=${bar}", helper.replacePlaceholders(text, props)); }
PropertySourcesPlaceholdersSanitizingResolver(Iterable<PropertySource<?>> sources, Sanitizer sanitizer) { super(sources, new PropertyPlaceholderHelper(SystemPropertyUtils.PLACEHOLDER_PREFIX, SystemPropertyUtils.PLACEHOLDER_SUFFIX, SystemPropertyUtils.VALUE_SEPARATOR, true)); this.sanitizer = sanitizer; }
private PropertyPlaceholderHelper createPlaceholderHelper(boolean ignoreUnresolvablePlaceholders) { return new PropertyPlaceholderHelper(this.placeholderPrefix, this.placeholderSuffix, this.valueSeparator, ignoreUnresolvablePlaceholders); }
public PlaceholderResolvingStringValueResolver(Properties props) { this.helper = new PropertyPlaceholderHelper( placeholderPrefix, placeholderSuffix, valueSeparator, ignoreUnresolvablePlaceholders); this.resolver = new PropertyPlaceholderConfigurerResolver(props); }
@Override protected void processProperties(ConfigurableListableBeanFactory beanFactoryToProcess, Properties props) throws BeansException { super.processProperties(beanFactoryToProcess, props); // store all the spring properties so we can refer to them later properties.putAll(props); // create helper helper = new PropertyPlaceholderHelper( configuredPlaceholderPrefix != null ? configuredPlaceholderPrefix : DEFAULT_PLACEHOLDER_PREFIX, configuredPlaceholderSuffix != null ? configuredPlaceholderSuffix : DEFAULT_PLACEHOLDER_SUFFIX, configuredValueSeparator != null ? configuredValueSeparator : DEFAULT_VALUE_SEPARATOR, configuredIgnoreUnresolvablePlaceholders != null ? configuredIgnoreUnresolvablePlaceholders : false); }
/** * Parse the given String value for placeholder resolution. * @param strVal the String value to parse * @param props the Properties to resolve placeholders against * @param visitedPlaceholders the placeholders that have already been visited * during the current resolution attempt (ignored in this version of the code) * @deprecated as of Spring 3.0, in favor of using {@link #resolvePlaceholder} * with {@link org.springframework.util.PropertyPlaceholderHelper}. * Only retained for compatibility with Spring 2.5 extensions. */ @Deprecated protected String parseStringValue(String strVal, Properties props, Set<?> visitedPlaceholders) { PropertyPlaceholderHelper helper = new PropertyPlaceholderHelper( placeholderPrefix, placeholderSuffix, valueSeparator, ignoreUnresolvablePlaceholders); PlaceholderResolver resolver = new PropertyPlaceholderConfigurerResolver(props); return helper.replacePlaceholders(strVal, resolver); }
public StaticStringValueResolver(final Map<String, String> values) { this.helper = new PropertyPlaceholderHelper("${", "}", ":", false); this.resolver = new PlaceholderResolver() { @Override public String resolvePlaceholder(String placeholderName) { return values.get(placeholderName); } }; }
public PlaceholderResolvingStringValueResolver(Properties props, String placeholderPrefix, String placeholderSuffix, String valueSeparator, boolean ignoreUnresolvablePlaceholders) { this.helper = new PropertyPlaceholderHelper(placeholderPrefix, placeholderSuffix, valueSeparator, ignoreUnresolvablePlaceholders); this.props = props; }
public PlaceholderResolvingStringValueResolver(Properties props, String placeholderPrefix, String placeholderSuffix, String valueSeparator, boolean ignoreUnresolvablePlaceholders) { this.helper = new PropertyPlaceholderHelper(placeholderPrefix, placeholderSuffix, valueSeparator, ignoreUnresolvablePlaceholders); this.props = props; }
public ResolvingProcessor(boolean ignoreUnresolvable, String resolveKey) { Assert.noBlanks(resolveKey); this.ignoreUnresolvable = ignoreUnresolvable; this.resolveKey = resolveKey; this.helper = new PropertyPlaceholderHelper("${", "}", ":", ignoreUnresolvable); }
public PlaceholderResolvingStringValueResolver(Properties props) { this.helper = new PropertyPlaceholderHelper( placeholderPrefix, placeholderSuffix, valueSeparator, ignoreUnresolvablePlaceholders); this.resolver = new PropertyPlaceholderConfigurerResolver(props); }
String stringToBeInterpolated = ....; Properties properties = System.getProperties(); PropertyPlaceholderHelper helper = new PropertyPlaceholderHelper("${","}"); String interpolatedValue = helper.replacePlaceholders(stringToBeInterpolated , properties);
protected String getFilteredContent(String location, Properties properties, String encoding) { PropertyPlaceholderHelper helper = new PropertyPlaceholderHelper("${", "}", ":", true); String originalContent = LocationUtils.toString(location, encoding); String filteredContent = helper.replacePlaceholders(originalContent, properties); return filteredContent; }