|
56 | 56 | import io.a2a.spec.Message; |
57 | 57 | import io.a2a.spec.MessageSendParams; |
58 | 58 | import io.a2a.spec.PushNotificationConfig; |
59 | | -import io.a2a.spec.PushNotificationNotSupportedError; |
60 | 59 | import io.a2a.spec.StreamingEventKind; |
61 | 60 | import io.a2a.spec.Task; |
62 | 61 | import io.a2a.spec.TaskIdParams; |
@@ -208,17 +207,37 @@ public class DefaultRequestHandler implements RequestHandler { |
208 | 207 | */ |
209 | 208 | int consumptionCompletionTimeoutSeconds; |
210 | 209 |
|
211 | | - private final AgentExecutor agentExecutor; |
212 | | - private final TaskStore taskStore; |
213 | | - private final QueueManager queueManager; |
214 | | - private final PushNotificationConfigStore pushConfigStore; |
215 | | - private final PushNotificationSender pushSender; |
216 | | - private final Supplier<RequestContext.Builder> requestContextBuilder; |
| 210 | + // Fields set by constructor injection cannot be final. We need a noargs constructor for |
| 211 | + // Jakarta compatibility, and it seems that making fields set by constructor injection |
| 212 | + // final, is not proxyable in all runtimes |
| 213 | + private AgentExecutor agentExecutor; |
| 214 | + private TaskStore taskStore; |
| 215 | + private QueueManager queueManager; |
| 216 | + private PushNotificationConfigStore pushConfigStore; |
| 217 | + private PushNotificationSender pushSender; |
| 218 | + private Supplier<RequestContext.Builder> requestContextBuilder; |
217 | 219 |
|
218 | 220 | private final ConcurrentMap<String, CompletableFuture<Void>> runningAgents = new ConcurrentHashMap<>(); |
219 | 221 | private final Set<CompletableFuture<Void>> backgroundTasks = ConcurrentHashMap.newKeySet(); |
220 | 222 |
|
221 | | - private final Executor executor; |
| 223 | + private Executor executor; |
| 224 | + |
| 225 | + /** |
| 226 | + * No-args constructor for CDI proxy creation. |
| 227 | + * CDI requires a non-private constructor to create proxies for @ApplicationScoped beans. |
| 228 | + * All fields are initialized by the @Inject constructor during actual bean creation. |
| 229 | + */ |
| 230 | + @SuppressWarnings("NullAway") |
| 231 | + protected DefaultRequestHandler() { |
| 232 | + // For CDI proxy creation |
| 233 | + this.agentExecutor = null; |
| 234 | + this.taskStore = null; |
| 235 | + this.queueManager = null; |
| 236 | + this.pushConfigStore = null; |
| 237 | + this.pushSender = null; |
| 238 | + this.requestContextBuilder = null; |
| 239 | + this.executor = null; |
| 240 | + } |
222 | 241 |
|
223 | 242 | @Inject |
224 | 243 | public DefaultRequestHandler(AgentExecutor agentExecutor, TaskStore taskStore, |
|
0 commit comments