diff --git a/http-generator-core/src/main/java/io/avaje/http/generator/core/BaseProcessor.java b/http-generator-core/src/main/java/io/avaje/http/generator/core/BaseProcessor.java index 485835fa..cb89e4c1 100644 --- a/http-generator-core/src/main/java/io/avaje/http/generator/core/BaseProcessor.java +++ b/http-generator-core/src/main/java/io/avaje/http/generator/core/BaseProcessor.java @@ -27,7 +27,7 @@ @GenerateAPContext @GenerateModuleInfoReader -@SupportedOptions({"useJavax", "useSingleton", "instrumentRequests","disableDirectWrites"}) +@SupportedOptions({"useJavax", "useSingleton", "instrumentRequests","disableDirectWrites","disableJsonB"}) public abstract class BaseProcessor extends AbstractProcessor { protected String contextPathString; diff --git a/http-generator-core/src/main/java/io/avaje/http/generator/core/ProcessingContext.java b/http-generator-core/src/main/java/io/avaje/http/generator/core/ProcessingContext.java index c3fcbf2e..4d5fccce 100644 --- a/http-generator-core/src/main/java/io/avaje/http/generator/core/ProcessingContext.java +++ b/http-generator-core/src/main/java/io/avaje/http/generator/core/ProcessingContext.java @@ -54,6 +54,7 @@ private static final class Ctx { private final String diAnnotation; private final boolean instrumentAllMethods; private final boolean disableDirectWrites; + private final boolean disableJsonB; private final boolean javalin6; private final Set clientFQN = new HashSet<>(); @@ -73,6 +74,7 @@ private static final class Ctx { final var singletonOverride = options.get("useSingleton"); this.instrumentAllMethods = Boolean.parseBoolean(options.get("instrumentRequests")); this.disableDirectWrites = Boolean.parseBoolean(options.get("disableDirectWrites")); + this.disableJsonB = Boolean.parseBoolean(options.get("disableJsonB")); if (singletonOverride != null) { useComponent = !Boolean.parseBoolean(singletonOverride); } else { @@ -202,6 +204,10 @@ public static boolean instrumentAllWebMethods() { } public static boolean useJsonb() { + return isJsonbInClasspath() && !CTX.get().disableJsonB; + } + + private static boolean isJsonbInClasspath() { try { return CTX.get().elementUtils.getTypeElement("io.avaje.jsonb.Jsonb") != null || Class.forName("io.avaje.jsonb.Jsonb") != null; diff --git a/tests/test-jex/pom.xml b/tests/test-jex/pom.xml index d512f1f1..7c006b12 100644 --- a/tests/test-jex/pom.xml +++ b/tests/test-jex/pom.xml @@ -79,31 +79,7 @@ - - io.avaje - avaje-inject-generator - ${avaje-inject.version} - provided - - - - io.avaje - avaje-http-jex-generator - ${project.version} - provided - - - - io.avaje - avaje-jsonb-generator - 3.0 - - - io.jstach - jstachio-apt - 1.3.6 - @@ -126,6 +102,44 @@ app + + org.apache.maven.plugins + maven-compiler-plugin + 3.14.0 + + + + + + + io.avaje + avaje-inject-generator + ${avaje-inject.version} + + + io.avaje + avaje-http-jex-generator + ${project.version} + + + io.avaje + avaje-jsonb-generator + 3.0 + + + io.avaje + avaje-validator-generator + 2.8 + + + io.jstach + jstachio-apt + 1.3.6 + + + + + io.avaje openapi-maven-plugin @@ -153,6 +167,20 @@ + + + io.avaje + avaje-inject-maven-plugin + 11.2 + + + process-sources + + provides + + + +