From 30251779242ec5440f30e99857de2a68fe991bfc Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Tue, 25 May 2021 09:53:30 +0300 Subject: [PATCH] Fail at build time if @Inject is used in JAX-RS Application class Relates to: #17441 --- .../common/processor/scanning/ResteasyReactiveScanner.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/independent-projects/resteasy-reactive/common/processor/src/main/java/org/jboss/resteasy/reactive/common/processor/scanning/ResteasyReactiveScanner.java b/independent-projects/resteasy-reactive/common/processor/src/main/java/org/jboss/resteasy/reactive/common/processor/scanning/ResteasyReactiveScanner.java index 55b2e9c5a6d35..dc877aaf7c1b7 100644 --- a/independent-projects/resteasy-reactive/common/processor/src/main/java/org/jboss/resteasy/reactive/common/processor/scanning/ResteasyReactiveScanner.java +++ b/independent-projects/resteasy-reactive/common/processor/src/main/java/org/jboss/resteasy/reactive/common/processor/scanning/ResteasyReactiveScanner.java @@ -66,7 +66,10 @@ public static ApplicationScanningResult scanForApplicationClass(IndexView index, throw new RuntimeException("More than one Application class: " + applications); } selectedAppClass = applicationClassInfo; - // FIXME: yell if there's more than one + if (!selectedAppClass.annotations().get(ResteasyReactiveDotNames.CDI_INJECT).isEmpty()) { + throw new RuntimeException("'@Inject' cannot be used with a '" + ResteasyReactiveDotNames.APPLICATION + + "' class. Offending class is: '" + selectedAppClass.name() + "'"); + } String applicationClass = applicationClassInfo.name().toString(); try { Class appClass = Thread.currentThread().getContextClassLoader().loadClass(applicationClass);