Skip to content

[ISSUE #7311] Decouple registry core from implementations. - #7578

Merged
Aias00 merged 1 commit into
apache:masterfrom
yangjj-iso:fix/7311-registry-dependencies
Oct 13, 2026
Merged

Aias00 merged 1 commit into
apache:masterfrom
yangjj-iso:fix/7311-registry-dependencies

Conversation

@yangjj-iso

Copy link
Copy Markdown
Contributor

shenyu-registry-core currently brings every built-in registry client into Admin and SDK applications. This change limits core to API/SPI dependencies and loads the configured provider from the application's classpath.

Fixes #7311.

  • Move the five original provider dependencies into the compatibility registry starter, retaining their compile scope and existing configuration keys. Admin explicitly declares its supported providers. SDK libraries use the API, SDK starters explicitly include core, and examples/integration gateways select their configured providers.
  • Add actionable missing-provider errors and an uncached loading entry point for Admin's independent discovery connections. Preserve the existing factory cache, initialization/reinitialization behavior, and all published SPI resources/keys.
  • Add real SPI tests for all six in-repository providers, isolated zero/one/multiple-provider factory tests (including external consul/polaris keys), and starter context/registration tests. Check 13 resolved runtime dependency trees in CI to prevent client or implementation leakage into core/SDK consumers.
  • Document direct dependency selection, the 2.7.2 compatibility path, external providers, rollback, and the actual distribution registry/client inventory in shenyu-registry/README.md. Both distributions retain clients supplied by their selected modules, so their existing LICENSE/NOTICE entries remain applicable.

Validation:

  • Full reactor ./mvnw -B -ntp -T 4 clean install -DskipTests -Dmaven.javadoc.skip=true -DskipRemoteResources=true -Djacoco.skip=true passed, including Checkstyle and RAT; standalone apache-rat:check also passed.
  • Complete registry, SDK and three starter module suites passed: 91 registry, 75 executed SDK and 11 starter tests. Six existing SDK tests are skipped by the suite.
  • Admin DefaultDiscoveryProcessorTest and ZookeeperClientDiscoveryIntegrationTest passed (8 tests), including real HTTP client registration, Admin and embedded ZooKeeper discovery/sync.
  • Dependency assertions passed for 13 runtime trees; all five SDK consumer examples and HTTP/Dubbo/upload integration modules packaged successfully. Their trees select ZooKeeper, Eureka, or no provider as configured.
  • Admin and Bootstrap release archives packaged successfully and contain LICENSE/NOTICE. Their packaged library inventories were inspected.

External Consul/Polaris compatibility is exercised through SPI resource fixtures; the external plugin JARs and Docker-based full-stack suites were not run locally.

  • Contribution guidelines reviewed.
  • Regression tests included.
  • Local build and relevant tests passed as detailed above.

@Aias00 Aias00 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this cleanup. Decoupling shenyu-registry-core from the concrete registry implementations (zookeeper/etcd/nacos/eureka/kubernetes) is the right call: it shrinks SDK/classpath surfaces, makes lean distributions possible, and the new registry_dependencies CI gate backed by check-registry-dependencies.py gives us a real regression guard instead of relying on reviewers to eyeball pom.xml.

What I verified before approving (all against the PR head 5d7c38e):

  • Factory API surface is real and public. ShenyuInstanceRegisterRepositoryFactory.loadRepository(...) is the new center of gravity. I confirmed every shenyu-spi API it depends on exists and is public in shenyu-spi's ExtensionLoader: getExtensionLoader(Class, ClassLoader) (ExtensionLoader.java:92), getExtensionClasses1() (ExtensionLoader.java:234), and the LOADERS field the rewritten test reaches via reflection. The IllegalArgumentException path for blank/unknown register types is clear and actionable.
  • No missing-import compile gap for commons-lang3. The factory now imports org.apache.commons.lang3.StringUtils. shenyu-spi declares commons-lang3 directly (shenyu-spi/pom.xml:32), so core still gets it transitively after the impl deps were dropped.
  • shenyu-admin still resolves the factory. It declares shenyu-registry-core (shenyu-admin/pom.xml:346), so AbstractDiscoveryProcessor.createDiscovery switching from raw SPI to ShenyuInstanceRegisterRepositoryFactory.loadRepository(type) compiles.
  • SDK modules drop core safely. shenyu-sdk-core / shenyu-sdk-feign moving from shenyu-registry-core to shenyu-registry-api is safe — I grepped their sources and found zero references to org.apache.shenyu.registry.core. The SDK starters (shenyu-spring-boot-starter-sdk, ...-sdk-feign) correctly re-add shenyu-registry-core, so the factory remains available to applications.
  • New CI gate won't self-false-positive. None of the six implementation modules depend on shenyu-registry-core, so the IMPLEMENTATION_MODULES must not depend on core assertion in check-registry-dependencies.py passes for this very PR.
  • Distribution preserved. shenyu-admin re-declares the five provider deps at runtime scope and shenyu-spring-boot-starter-registry keeps all five, matching the README migration notes and avoiding a classpath regression for existing users.

CI: green. pr_build, rat_check, check-license-header, Analyze (java), and the new registry_dependencies job all pass; the full integrated-test / e2e matrix is green on the head commit. mergeable against master (no conflicts).

Non-blocking suggestions (not required for approval):

  1. loadRepository's error message builds shenyu-registry-<registerType>, which is misleading for external providers (Consul/Polaris) that aren't named shenyu-registry-*. The trailing "(or an external registry SPI provider)" caveat already covers it, but branching the hint on whether the key looks like a built-in would read even better.
  2. getExtensionClasses1() has an unusual "1" suffix that reads like an internal overload. It's stable public API today, but core now couples to that exact name; a getExtensionClasses() alias in shenyu-spi (or documenting the method) would make the cross-module dependency less surprising.

Approving — this is ready to merge once the branch-protection approval threshold is met.

@Aias00
Aias00 merged commit a7d80b7 into apache:master Oct 13, 2026
54 checks passed
Aias00 pushed a commit that referenced this pull request Oct 16, 2026
…#7585) (#7642)

PR #7578 removed the five registry implementation dependencies from
shenyu-registry-core, which is a runtime-visible behavior change for
downstream users rather than a code-organization-only refactor: an
application on shenyu-registry-core (or on shenyu-sdk-core /
shenyu-sdk-feign, which now sit on shenyu-registry-api) no longer gets
the implementations transitively, so an upgrade without an explicit
provider declaration fails at startup. The registerType-with-no-provider
case also changes from silent to throwing.

Adds one entry under Unreleased / Behavior Changes covering that, the
new public loadRepository(String) surface, and the compatibility story
for shenyu-admin and shenyu-spring-boot-starter-registry. Migration
guidance is delegated to shenyu-registry/README.md, added by #7578.

Documentation only.

Fixes #7585
@Aias00 Aias00 added this to the 2.7.2 milestone Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Task] Invert shenyu-registry-core dependencies and load registry implementations explicitly

2 participants