From b516d1452c22ab60e158db0d765c25480b18e157 Mon Sep 17 00:00:00 2001 From: Mark McLaughlin Date: Wed, 25 Sep 2024 17:49:08 +0100 Subject: [PATCH] Add no-args contructors for abstract constructors to support quarkus client injection. --- .../java/org/project_kessel/clients/KesselClient.java | 9 +++++++++ .../project_kessel/clients/KesselClientsManager.java | 11 ++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/project_kessel/clients/KesselClient.java b/src/main/java/org/project_kessel/clients/KesselClient.java index ebf6da7..b45245a 100644 --- a/src/main/java/org/project_kessel/clients/KesselClient.java +++ b/src/main/java/org/project_kessel/clients/KesselClient.java @@ -7,6 +7,15 @@ public abstract class KesselClient, B extends Abs protected A asyncStub; protected B blockingStub; + /*** + * No args constructor to support synthetic creation of no-args constructor in CDI in impls for normal scope bean + * proxying. Supports producers (@Produces) of @ApplicationScoped beans in containers like Quarkus. + * (https://github.com/quarkusio/quarkus/issues/22669#issuecomment-1006147659) + */ + protected KesselClient() { + + } + protected KesselClient(A asyncStub, B blockingStub) { this.asyncStub = asyncStub; this.blockingStub = blockingStub; diff --git a/src/main/java/org/project_kessel/clients/KesselClientsManager.java b/src/main/java/org/project_kessel/clients/KesselClientsManager.java index d79f4e4..ca54784 100644 --- a/src/main/java/org/project_kessel/clients/KesselClientsManager.java +++ b/src/main/java/org/project_kessel/clients/KesselClientsManager.java @@ -3,7 +3,16 @@ import io.grpc.Channel; public abstract class KesselClientsManager { - protected final Channel channel; + protected Channel channel; + + /*** + * No args constructor to support synthetic creation of no-args constructor in CDI in impls for normal scope bean + * proxying. Supports producers (@Produces) of @ApplicationScoped beans in containers like Quarkus. + * (https://github.com/quarkusio/quarkus/issues/22669#issuecomment-1006147659) + */ + protected KesselClientsManager() { + + } protected KesselClientsManager(Channel channel) { this.channel = channel;