Skip to content

[Bug] An instance of the subclass of RegistryConfig should be added to configsCache as the RegistryConfig class type #15016

@youjie23

Description

@youjie23

Pre-check

  • I am sure that all the content I provide is in English.

Search before asking

  • I had searched in the issues and found no similar issues.

Apache Dubbo Component

Java SDK (apache/dubbo)

Dubbo Version

Dubbo3.2.9 Dubbo3.3.2
Jdk17

Steps to reproduce this issue

When a custom subclass of RegistryConfig is created with a simple class name different from 'RegistryConfig', it leads to an unexpected behavior where an IllegalStateException is thrown, reporting 'Registry not found:' along with the associated ID. This behavior indicates a bug because all subclasses of RegistryConfig should be recognized regardless of their simple names.

code likes below:

  public  class CustomRegistryConfig extend RegistryConfig{
    //customize code
}

What you expected to happen

When processing CustomRegistryConfig, it should be treated as an instance of the RegistryConfig class type rather than being handled specifically as the CustomRegistryConfig class. This ensures consistency with the expected type handling in the system.

Anything else

The error in the AbstractConfigManager class's addConfig method stems from its logic, which currently relies on the simple name of the provided config class. However, the correct approach should involve using the simple name of the parent class that is listed in the supportedConfigTypes. This ensures consistency and proper type handling within the configuration management system.

Are you willing to submit a pull request to fix on your own?

  • Yes I am willing to submit a pull request on my own!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions