Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> clientFQN = new HashSet<>();

Expand All @@ -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 {
Expand Down Expand Up @@ -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;
Expand Down
76 changes: 52 additions & 24 deletions tests/test-jex/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,31 +79,7 @@

<!-- java annotation processors -->

<dependency>
<groupId>io.avaje</groupId>
<artifactId>avaje-inject-generator</artifactId>
<version>${avaje-inject.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>io.avaje</groupId>
<artifactId>avaje-http-jex-generator</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>io.avaje</groupId>
<artifactId>avaje-jsonb-generator</artifactId>
<version>3.0</version>
</dependency>

<dependency>
<groupId>io.jstach</groupId>
<artifactId>jstachio-apt</artifactId>
<version>1.3.6</version>
</dependency>

<!-- test dependencies -->
<dependency>
Expand All @@ -126,6 +102,44 @@
<finalName>app</finalName>
<plugins>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.14.0</version>
<configuration>
<!-- <compilerArgs>-->
<!-- <arg>-AdisableJsonB=true</arg>-->
<!-- </compilerArgs>-->
<annotationProcessorPaths>
<path>
<groupId>io.avaje</groupId>
<artifactId>avaje-inject-generator</artifactId>
<version>${avaje-inject.version}</version>
</path>
<path>
<groupId>io.avaje</groupId>
<artifactId>avaje-http-jex-generator</artifactId>
<version>${project.version}</version>
</path>
<path>
<groupId>io.avaje</groupId>
<artifactId>avaje-jsonb-generator</artifactId>
<version>3.0</version>
</path>
<path>
<groupId>io.avaje</groupId>
<artifactId>avaje-validator-generator</artifactId>
<version>2.8</version>
</path>
<path>
<groupId>io.jstach</groupId>
<artifactId>jstachio-apt</artifactId>
<version>1.3.6</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>

<plugin>
<groupId>io.avaje</groupId>
<artifactId>openapi-maven-plugin</artifactId>
Expand Down Expand Up @@ -153,6 +167,20 @@
</configuration>
</plugin>

<!-- generated by avaje inject -->
<plugin>
<groupId>io.avaje</groupId>
<artifactId>avaje-inject-maven-plugin</artifactId>
<version>11.2</version>
<executions>
<execution>
<phase>process-sources</phase>
<goals>
<goal>provides</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down