fix(nacos-starter): auto-configurations should be opt-in (matchIfMissing=false) and fix A2A server-addr override
AgentScope-Java Version 2.0.0-RC2
Description
Two bugs in agentscope-nacos-spring-boot-starter cause startup crashes and silent server-addr override.
-
matchIfMissing=true on @ConditionalOnProperty in AgentscopeNacosPromptAutoConfiguration and AgentscopeA2aNacosAutoConfiguration (and its nested discovery/registry beans) causes both auto-configurations to activate even when the user has not configured the feature. The Javadoc states these are opt-in features requiring enabled=true, but the implementation behaves as opt-out. Changed matchIfMissing to false.
-
AgentscopeA2aNacosAutoConfiguration.a2aService() calls a2aNacosProperties.getNacosProperties() when merging A2A-specific config on top of the base config. getNacosProperties() fills in 127.0.0.1:8848 as a default, which then overwrites the user-configured agentscope.nacos.server-addr via putAll. Fixed by using getExplicitNacosProperties() instead — BaseNacosProperties documents this method as the correct choice for overlay/merge scenarios.
To test: existing tests shouldNotCreateBeansWhenDisabled and shouldNotCreateNacosBeansWhenDisabled cover the matchIfMissing fix. The server-addr fix can be verified by running shouldNotOverwriteGlobalServerAddrWhenPromptNotSet in AgentscopeNacosPromptAutoConfigurationTest.
Fixes #1707