You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "youjie23 (via GitHub)" <gi...@apache.org> on 2024/12/24 18:05:10 UTC

[I] [Bug] When processing `CustomRegistryConfig`, it should be treated as an instance of the `RegistryConfig` class type rather than being handled specifically as the `CustomRegistryConfig` class [dubbo]

youjie23 opened a new issue, #15016:
URL: https://github.com/apache/dubbo/issues/15016

   ### Pre-check
   
   - [X] I am sure that all the content I provide is in English.
   
   
   ### Search before asking
   
   - [X] I had searched in the [issues](https://github.com/apache/dubbo/issues?q=is%3Aissue) 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?
   
   - [X] Yes I am willing to submit a pull request on my own!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [I] [Bug] An instance of the subclass of RegistryConfig should be added to configsCache as the RegistryConfig class type [dubbo]

Posted by "youjie23 (via GitHub)" <gi...@apache.org>.
youjie23 commented on issue #15016:
URL: https://github.com/apache/dubbo/issues/15016#issuecomment-2589249267

   > Why do you want to extend a `Config`?
   
   Thank you for your response.
   
   In certain scenarios, we want to encapsulate some common logic in a unified manner. For example, we would like to directly map some rules based on spring.profiles.active to fixed dubbo.registry.group, and unify the dubbo-registry-local.cache path, etc.
   
   This approach aims to streamline configuration management and ensure consistency across different environments or profiles. By doing so, we can simplify the setup process and reduce potential configuration errors


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [I] [Bug] An instance of the subclass of RegistryConfig should be added to configsCache as the RegistryConfig class type [dubbo]

Posted by "AlbumenJ (via GitHub)" <gi...@apache.org>.
AlbumenJ commented on issue #15016:
URL: https://github.com/apache/dubbo/issues/15016#issuecomment-2571541847

   Why do you want to extend a `Config`?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [I] [Bug] An instance of the subclass of RegistryConfig should be added to configsCache as the RegistryConfig class type [dubbo]

Posted by "AlbumenJ (via GitHub)" <gi...@apache.org>.
AlbumenJ closed issue #15016: [Bug] An instance of the subclass of RegistryConfig should be added to configsCache as the RegistryConfig class type
URL: https://github.com/apache/dubbo/issues/15016


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org