You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2022/03/25 10:48:18 UTC
[camel-quarkus] branch main updated: Fix loading of XML routes with routes-include-pattern wildcard
This is an automated email from the ASF dual-hosted git repository.
jamesnetherton pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/main by this push:
new 7667682 Fix loading of XML routes with routes-include-pattern wildcard
7667682 is described below
commit 76676820eeba51888c1292002be8bf5bcc955439
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 +++++
.../src/test/resources/application.properties | 2 +-
3 files changed, 38 insertions(+), 1 deletion(-)
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();
diff --git a/extensions/openapi-java/deployment/src/test/resources/application.properties b/extensions/openapi-java/deployment/src/test/resources/application.properties
index a5d206d..62f6015 100644
--- a/extensions/openapi-java/deployment/src/test/resources/application.properties
+++ b/extensions/openapi-java/deployment/src/test/resources/application.properties
@@ -23,4 +23,4 @@ quarkus.camel.openapi.expose.enabled=true
# Camel - REST
#
camel.rest.context-path=/camel
-camel.main.routes-include-pattern=routes/routes.xml,routes/rests.xml
+camel.main.routes-include-pattern=routes/*.xml