You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pp...@apache.org on 2022/03/31 09:47:48 UTC
[camel-quarkus] 16/43: Fix loading of XML routes with routes-include-pattern wildcard
This is an automated email from the ASF dual-hosted git repository.
ppalaga pushed a commit to branch 2.7.x
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
commit ae4c9c861fbf1c26e3e66268df9edaf8fc2fab89
Author: James Netherton <ja...@gmail.com>
AuthorDate: Fri Mar 25 08:11:11 2022 +0000
Fix loading of XML routes with routes-include-pattern wildcard
Fixes #3265
---
.../CamelQuarkusPackageScanResourceResolver.java | 31 ++++++++++++++++++++++
.../camel/quarkus/core/FastCamelContext.java | 6 +++++
2 files changed, 37 insertions(+)
diff --git a/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/CamelQuarkusPackageScanResourceResolver.java b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/CamelQuarkusPackageScanResourceResolver.java
new file mode 100644
index 0000000..7d7dde7
--- /dev/null
+++ b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/CamelQuarkusPackageScanResourceResolver.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.core;
+
+import org.apache.camel.impl.engine.DefaultPackageScanResourceResolver;
+import org.apache.camel.spi.PackageScanResourceResolver;
+
+/**
+ * Custom {@link PackageScanResourceResolver} that adds the specific {@link ClassLoader} instance
+ * that Camel Quarkus requires for resolving resources.
+ */
+public class CamelQuarkusPackageScanResourceResolver extends DefaultPackageScanResourceResolver {
+ @Override
+ public void initialize() {
+ addClassLoader(Thread.currentThread().getContextClassLoader());
+ }
+}
diff --git a/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/FastCamelContext.java b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/FastCamelContext.java
index 2a40f04..1dccaf3 100644
--- a/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/FastCamelContext.java
+++ b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/FastCamelContext.java
@@ -41,6 +41,7 @@ import org.apache.camel.spi.Language;
import org.apache.camel.spi.ManagementNameStrategy;
import org.apache.camel.spi.ModelJAXBContextFactory;
import org.apache.camel.spi.ModelToXMLDumper;
+import org.apache.camel.spi.PackageScanResourceResolver;
import org.apache.camel.spi.PropertiesComponent;
import org.apache.camel.spi.Registry;
import org.apache.camel.spi.ShutdownStrategy;
@@ -162,6 +163,11 @@ public class FastCamelContext extends DefaultCamelContext implements CatalogCame
}
@Override
+ protected PackageScanResourceResolver createPackageScanResourceResolver() {
+ return new CamelQuarkusPackageScanResourceResolver();
+ }
+
+ @Override
public void doInit() throws Exception {
super.doInit();
forceLazyInitialization();