Repository navigation
fix(spring): bind the agent executor pool by bean name, not by type - #97
Closed
Zhoujie628 wants to merge 1 commit into
Closed
Zhoujie628 wants to merge 1 commit into
Zhoujie628 wants to merge 1 commit into
Conversation
agentExecutorPool used a bare @ConditionalOnMissingBean, which matches by return type (ExecutorService). Host applications routinely define their own ExecutorService beans - dispatchers, ScheduledExecutorService-based SSE heartbeat schedulers, pub-sub workers - and because user configuration registers before auto-configuration, any one of them suppressed the A2A pool. requestHandler and restHandler then injected ExecutorService by type without a qualifier, found several candidates (none primary), and the application failed to refresh with NoUniqueBeanDefinitionException at "Parameter 5 of method requestHandler". Match by bean name instead: the pool is always auto-configured unless the host declares its own bean named agentExecutorPool, and both injection points take @qualifier("agentExecutorPool"). Capacity keeps coming from the a2at.server.executor-* properties. Regression: a WebApplicationContextRunner with foreign ExecutorService and ScheduledExecutorService beans pre-registered now starts and wires the auto-configured pool (verified to reproduce the reported NoUniqueBeanDefinitionException without the fix), plus a host-override test where a same-named bean replaces the auto-configured one. Signed-off-by: tangzhiqiang <tangzhiqiang@gdcattsoft.com>
Contributor
Author
|
Closing to resubmit this change from the contributor fork so that the pull request is opened by the commit author ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #96
Summary
@Bean(name = "agentExecutorPool")+@ConditionalOnMissingBean(name = "agentExecutorPool")@Qualifier("agentExecutorPool")(requestHandlerparameter 5 andrestHandler)Why
The bare
@ConditionalOnMissingBeanmatched by return type (ExecutorService), so any host executor bean suppressed the pool; the handlers then injectedExecutorServiceby type and failed withNoUniqueBeanDefinitionExceptionat parameter 5 ofrequestHandler.Verification
mvn -pl spring-boot-starter test: 32 tests passWebApplicationContextRunnerregression test with two foreignExecutorService/ScheduledExecutorServicebeans - fails before the fix with the reported exception, passes afteragentExecutorPoolreplaces the auto-configured onemvn -pl spring-boot-starter spotless:checkpasses