/** * Resolve the given path, replacing placeholders with corresponding * property values from the {@code environment} if necessary. * @param path the original file path * @return the resolved file path * @see PropertyResolver#resolvePlaceholders * @see PropertyResolver#resolveRequiredPlaceholders */ protected String resolvePath(String path) { if (this.propertyResolver == null) { this.propertyResolver = new StandardEnvironment(); } return (this.ignoreUnresolvablePlaceholders ? this.propertyResolver.resolvePlaceholders(path) : this.propertyResolver.resolveRequiredPlaceholders(path)); }
/** * Resolve the given path, replacing placeholders with * corresponding system property values if necessary. * @param path the original file path * @return the resolved file path * @see PropertyResolver#resolvePlaceholders * @see PropertyResolver#resolveRequiredPlaceholders(String) */ protected String resolvePath(String path) { if (this.propertyResolver == null) { this.propertyResolver = new StandardEnvironment(); } return (this.ignoreUnresolvablePlaceholders ? this.propertyResolver.resolvePlaceholders(path) : this.propertyResolver.resolveRequiredPlaceholders(path)); }
/** * Resolve the given path, replacing placeholders with corresponding * property values from the {@code environment} if necessary. * @param path the original file path * @return the resolved file path * @see PropertyResolver#resolvePlaceholders * @see PropertyResolver#resolveRequiredPlaceholders */ protected String resolvePath(String path) { if (this.propertyResolver == null) { this.propertyResolver = new StandardEnvironment(); } return (this.ignoreUnresolvablePlaceholders ? this.propertyResolver.resolvePlaceholders(path) : this.propertyResolver.resolveRequiredPlaceholders(path)); }
/** * Resolve the given path, replacing placeholders with * corresponding system property values if necessary. * @param path the original file path * @return the resolved file path * @see PropertyResolver#resolvePlaceholders * @see PropertyResolver#resolveRequiredPlaceholders(String) */ protected String resolvePath(String path) { if (this.propertyResolver == null) { this.propertyResolver = new StandardEnvironment(); } return (this.ignoreUnresolvablePlaceholders ? this.propertyResolver.resolvePlaceholders(path) : this.propertyResolver.resolveRequiredPlaceholders(path)); }
@Test public void resolveRequiredPlaceholders() { MutablePropertySources propertySources = new MutablePropertySources(); propertySources.addFirst(new MockPropertySource().withProperty("key", "value")); PropertyResolver resolver = new PropertySourcesPropertyResolver(propertySources); assertThat(resolver.resolveRequiredPlaceholders("Replace this ${key}"), equalTo("Replace this value")); }
@Test public void resolveRequiredPlaceholders_withDefaultValue() { MutablePropertySources propertySources = new MutablePropertySources(); propertySources.addFirst(new MockPropertySource().withProperty("key", "value")); PropertyResolver resolver = new PropertySourcesPropertyResolver(propertySources); assertThat(resolver.resolveRequiredPlaceholders("Replace this ${key} plus ${unknown:defaultValue}"), equalTo("Replace this value plus defaultValue")); }
@Test(expected = IllegalArgumentException.class) public void resolveRequiredPlaceholders_withUnresolvable() { MutablePropertySources propertySources = new MutablePropertySources(); propertySources.addFirst(new MockPropertySource().withProperty("key", "value")); PropertyResolver resolver = new PropertySourcesPropertyResolver(propertySources); resolver.resolveRequiredPlaceholders("Replace this ${key} plus ${unknown}"); }
/** * Resolve the given path, replacing placeholders with corresponding * property values from the <code>environment</code> if necessary. * @param path the original file path * @return the resolved file path * @see PropertyResolver#resolvePlaceholders * @see PropertyResolver#resolveRequiredPlaceholders */ protected String resolvePath(String path) { return this.ignoreUnresolvablePlaceholders ? this.propertyResolver.resolvePlaceholders(path) : this.propertyResolver.resolveRequiredPlaceholders(path); }
/** * Resolve the given path, replacing placeholders with * corresponding system property values if necessary. * @param path the original file path * @return the resolved file path * @see PropertyResolver#resolvePlaceholders * @see PropertyResolver#resolveRequiredPlaceholders(String) */ protected String resolvePath(String path) { return this.ignoreUnresolvablePlaceholders ? this.propertyResolver.resolvePlaceholders(path) : this.propertyResolver.resolveRequiredPlaceholders(path); }
@Override public String resolveRequiredPlaceholders(String text) throws IllegalArgumentException { return delegate.resolveRequiredPlaceholders(text); } }
@Override public String resolveRequiredPlaceholders(String text) throws IllegalArgumentException { return delegate.resolveRequiredPlaceholders(text); } }
/** * Resolve the given path, replacing placeholders with * corresponding system property values if necessary. * @param path the original file path * @return the resolved file path * @see PropertyResolver#resolvePlaceholders * @see PropertyResolver#resolveRequiredPlaceholders(String) */ protected String resolvePath(String path) { if (this.propertyResolver == null) { this.propertyResolver = new StandardEnvironment(); } return (this.ignoreUnresolvablePlaceholders ? this.propertyResolver.resolvePlaceholders(path) : this.propertyResolver.resolveRequiredPlaceholders(path)); }
/** * Resolve the given path, replacing placeholders with corresponding * property values from the {@code environment} if necessary. * @param path the original file path * @return the resolved file path * @see PropertyResolver#resolvePlaceholders * @see PropertyResolver#resolveRequiredPlaceholders */ protected String resolvePath(String path) { if (this.propertyResolver == null) { this.propertyResolver = new StandardEnvironment(); } return (this.ignoreUnresolvablePlaceholders ? this.propertyResolver.resolvePlaceholders(path) : this.propertyResolver.resolveRequiredPlaceholders(path)); }
/** * Resolve the given path, replacing placeholders with * corresponding system property values if necessary. * @param path the original file path * @return the resolved file path * @see PropertyResolver#resolvePlaceholders * @see PropertyResolver#resolveRequiredPlaceholders(String) */ protected String resolvePath(String path) { if (this.propertyResolver == null) { this.propertyResolver = new StandardEnvironment(); } return (this.ignoreUnresolvablePlaceholders ? this.propertyResolver.resolvePlaceholders(path) : this.propertyResolver.resolveRequiredPlaceholders(path)); }
/** * Resolve the given path, replacing placeholders with corresponding * property values from the {@code environment} if necessary. * @param path the original file path * @return the resolved file path * @see PropertyResolver#resolvePlaceholders * @see PropertyResolver#resolveRequiredPlaceholders */ protected String resolvePath(String path) { if (this.propertyResolver == null) { this.propertyResolver = new StandardEnvironment(); } return (this.ignoreUnresolvablePlaceholders ? this.propertyResolver.resolvePlaceholders(path) : this.propertyResolver.resolveRequiredPlaceholders(path)); }