From f1924d456db7dbe277808677da0442c9b41df8f5 Mon Sep 17 00:00:00 2001
From: Stuart Douglas <stuart.w.douglas@gmail.com>
Date: Tue, 27 Apr 2021 21:22:07 +1000
Subject: [PATCH] Fix test ClassLoader issue

This prevents the base runtime CL from
loading deployment classes.

Fixes #16810
Fixes #16804
---
 .../java/io/quarkus/bootstrap/app/CuratedApplication.java   | 5 +++++
 .../src/main/resources/application.properties               | 6 +-----
 .../kafka-avro/src/main/resources/application.properties    | 4 ----
 3 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/app/CuratedApplication.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/app/CuratedApplication.java
index 1ec95f0e267538..567117ec9057cf 100644
--- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/app/CuratedApplication.java
+++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/app/CuratedApplication.java
@@ -216,6 +216,10 @@ public synchronized QuarkusClassLoader getBaseRuntimeClassLoader() {
                 for (Path root : quarkusBootstrap.getApplicationRoot()) {
                     builder.addElement(ClassPathElement.fromPath(root));
                 }
+            } else {
+                for (Path root : quarkusBootstrap.getApplicationRoot()) {
+                    builder.addBannedElement(ClassPathElement.fromPath(root));
+                }
             }
 
             //additional user class path elements first
@@ -228,6 +232,7 @@ public synchronized QuarkusClassLoader getBaseRuntimeClassLoader() {
                 } else {
                     for (Path root : i.getArchivePath()) {
                         hotReloadPaths.add(root);
+                        builder.addBannedElement(ClassPathElement.fromPath(root));
                     }
                 }
             }
diff --git a/integration-tests/kafka-avro-apicurio2/src/main/resources/application.properties b/integration-tests/kafka-avro-apicurio2/src/main/resources/application.properties
index 1713f0b4061eac..e22c540faa69dc 100644
--- a/integration-tests/kafka-avro-apicurio2/src/main/resources/application.properties
+++ b/integration-tests/kafka-avro-apicurio2/src/main/resources/application.properties
@@ -3,8 +3,4 @@ quarkus.log.category.\"org.apache.kafka\".level=WARN
 quarkus.log.category.\"org.apache.zookeeper\".level=WARN
 
 # enable health check
-quarkus.kafka.health.enabled=true
-
-# TODO: this should not be needed, but Avro does not seem to use the correct CL
-# This will also cause dev mode issues
-quarkus.test.flat-class-path=true
+quarkus.kafka.health.enabled=true
\ No newline at end of file
diff --git a/integration-tests/kafka-avro/src/main/resources/application.properties b/integration-tests/kafka-avro/src/main/resources/application.properties
index 46d8f7f298d32d..d4907bbe9f11b9 100644
--- a/integration-tests/kafka-avro/src/main/resources/application.properties
+++ b/integration-tests/kafka-avro/src/main/resources/application.properties
@@ -4,7 +4,3 @@ quarkus.log.category.\"org.apache.zookeeper\".level=WARN
 
 # enable health check
 quarkus.kafka.health.enabled=true
-
-# TODO: this should not be needed, but Avro does not seem to use the correct CL
-# This will also cause dev mode issues
-quarkus.test.flat-class-path=true
\ No newline at end of file