This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
commit 64fa5b1c52d1c0d213d1c1183c8233a3261b749a Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Mon Mar 22 16:05:41 2021 +0100 CAMEL-16384: camel-spring - BridgePropertyPlaceholderConfigurer should be LoadablePropertiesSource --- .../spi/BridgePropertyPlaceholderConfigurer.java | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/spi/BridgePropertyPlaceholderConfigurer.java b/components/camel-spring/src/main/java/org/apache/camel/spring/spi/BridgePropertyPlaceholderConfigurer.java index e97c81b..7df8631 100644 --- a/components/camel-spring/src/main/java/org/apache/camel/spring/spi/BridgePropertyPlaceholderConfigurer.java +++ b/components/camel-spring/src/main/java/org/apache/camel/spring/spi/BridgePropertyPlaceholderConfigurer.java @@ -17,9 +17,11 @@ package org.apache.camel.spring.spi; import java.util.Properties; +import java.util.function.Predicate; import org.apache.camel.component.properties.PropertiesLookup; import org.apache.camel.component.properties.PropertiesParser; +import org.apache.camel.spi.LoadablePropertiesSource; import org.apache.camel.spi.PropertiesSource; import org.springframework.beans.BeansException; import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; @@ -33,7 +35,7 @@ import org.springframework.util.PropertyPlaceholderHelper; * placeholder mechanism. */ public class BridgePropertyPlaceholderConfigurer extends PropertyPlaceholderConfigurer - implements PropertiesParser, PropertiesSource { + implements PropertiesParser, PropertiesSource, LoadablePropertiesSource { // NOTE: this class must be in the spi package as if its in the root package, then Spring fails to parse the XML // files due some weird spring issue. But that is okay as having this class in the spi package is fine anyway. @@ -138,6 +140,24 @@ public class BridgePropertyPlaceholderConfigurer extends PropertyPlaceholderConf return properties.getProperty(name); } + @Override + public Properties loadProperties() { + return properties; + } + + @Override + public Properties loadProperties(Predicate<String> filter) { + Properties props = new Properties(); + + for (String name : properties.stringPropertyNames()) { + if (filter.test(name)) { + props.put(name, properties.get(name)); + } + } + + return props; + } + private class BridgePropertyPlaceholderResolver implements PropertyPlaceholderHelper.PlaceholderResolver { private final PropertiesLookup properties;