You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2019/06/17 12:04:43 UTC

[camel] 08/20: CAMEL-13647: Allow to do autowrire by classpath. Quick and dirty prototype.

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 673719e90ce7ea4997565ffc55b129eced48ee47
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Jun 17 07:43:54 2019 +0200

    CAMEL-13647: Allow to do autowrire by classpath. Quick and dirty prototype.
---
 .../camel/impl/scan/AssignableToPackageScanFilter.java     | 14 +-------------
 .../org/apache/camel/support/PropertyBindingSupport.java   |  3 +--
 .../src/main/resources/application.properties              |  4 ++--
 3 files changed, 4 insertions(+), 17 deletions(-)

diff --git a/core/camel-base/src/main/java/org/apache/camel/impl/scan/AssignableToPackageScanFilter.java b/core/camel-base/src/main/java/org/apache/camel/impl/scan/AssignableToPackageScanFilter.java
index 56be02b..892b8fd 100644
--- a/core/camel-base/src/main/java/org/apache/camel/impl/scan/AssignableToPackageScanFilter.java
+++ b/core/camel-base/src/main/java/org/apache/camel/impl/scan/AssignableToPackageScanFilter.java
@@ -26,7 +26,6 @@ import org.apache.camel.spi.PackageScanFilter;
  */
 public class AssignableToPackageScanFilter implements PackageScanFilter {
     private final Set<Class<?>> parents = new HashSet<>();
-    private boolean includeInterfaces;
 
     public AssignableToPackageScanFilter() {
     }
@@ -39,24 +38,13 @@ public class AssignableToPackageScanFilter implements PackageScanFilter {
         this.parents.addAll(parents);
     }
 
-    public boolean isIncludeInterfaces() {
-        return includeInterfaces;
-    }
-
-    public void setIncludeInterfaces(boolean includeInterfaces) {
-        this.includeInterfaces = includeInterfaces;
-    }
-
     public void addParentType(Class<?> parentType) {
         parents.add(parentType);
     }
 
     public boolean matches(Class<?> type) {
-        if (parents.size() > 0) {
+        if (parents != null && parents.size() > 0) {
             for (Class<?> parent : parents) {
-                if (!includeInterfaces && parent.isInterface()) {
-                    continue;
-                }
                 if (parent.isAssignableFrom(type)) {
                     return true;
                 }
diff --git a/core/camel-support/src/main/java/org/apache/camel/support/PropertyBindingSupport.java b/core/camel-support/src/main/java/org/apache/camel/support/PropertyBindingSupport.java
index 462cdf2..c91bb5e 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/PropertyBindingSupport.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/PropertyBindingSupport.java
@@ -596,7 +596,7 @@ public final class PropertyBindingSupport {
                         } else {
                             if (mandatory) {
                                 // there is no getter with this given name, so lets report this as a problem
-                                throw new IllegalArgumentException("Cannot find nested getter method: " + part + " on bean: " + newClass + " when binding property: " + ognlPath);
+                                throw new IllegalArgumentException("Cannot find getter method: " + part + " on bean: " + newClass + " when binding property: " + ognlPath);
                             }
                         }
                     } else {
@@ -775,7 +775,6 @@ public final class PropertyBindingSupport {
         String cp = System.getProperty("java.class.path");
         String[] parts = cp.split(":");
         for (String p : parts) {
-            System.out.println(p);
             if (p.endsWith(".jar")) {
                 JarFile jar = new JarFile(p);
                 jar.stream().forEach(e -> {
diff --git a/examples/camel-example-main/src/main/resources/application.properties b/examples/camel-example-main/src/main/resources/application.properties
index 9af7830..fb4eb9f 100644
--- a/examples/camel-example-main/src/main/resources/application.properties
+++ b/examples/camel-example-main/src/main/resources/application.properties
@@ -42,8 +42,8 @@ camel.component.quartz2.start-delayed-seconds = 3
 # you can configure whether OS environment should override (=2 which is default) or as fallback (=1)
 ### camel.component.properties.environment-variable-mode=1
 
-### camel.component.jms.configuration.connectionFactory=#class:org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory
-### camel.component.jms.configuration.connectionFactory.#private#brokerURL=tcp://localhost:61616
+camel.component.jms.configuration.connectionFactory=#class:org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory
+camel.component.jms.configuration.xxxconnectionFactory.#private#brokerURL=tcp://localhost:61616
 
 # properties used in the route
 myCron = 0/2 * * * * ?