Skip to content

dubbo spi IOC some case not work #12800

Closed

Description

@xixingya
  • I have searched the issues of this repository and believe that this is not a duplicate.
    当你的接口只有一个实现类的时候,并且这个实现类被@adaptive注解。那么你在另外一个类中,通过inject将无法注入成功这个类
    When your interface has only one implementation class, and this implementation class is annotated with @adaptive. Then you are in another class, you will not be able to successfully inject this class through inject

Environment

  • Dubbo version: latest
  • Operating System version: mac os
  • Java version: 1.8

Steps to reproduce this issue

Pls. provide [GitHub address] to reproduce this issue.

Expected Behavior

当你的接口只有一个实现类的时候,并且这个实现类被@adaptive注解。那么你在另外一个类中,可以成功注入这个类。

When your interface has only one implementation class, and this implementation class is annotated with @adaptive. Then you are in another class and can successfully inject this class.

Actual Behavior

当你的接口只有一个实现类的时候,并且这个实现类被@adaptive注解。那么你在另外一个类中,无法成功注入这个类。
When your interface has only one implementation class, and this implementation class is annotated with @adaptive. Then you are in another class and cannot successfully inject this class.
具体可以看demo类中的main方法。当Log只有一个实现类的时候,并且这个实现类被注解,getLog是null。当log有两个实现类的时候,可以注入成功,比如说Log2这个接口,就可以注入成功。
For details, see the main method in the demo class. When Log has only one implementation class, and this implementation class is annotated, getLog is null. When the log has two implementation classes, it can be injected successfully. For example, the Log2 interface can be injected successfully.
请看:(please see)
https://github.com/xixingya/dubbo-demo

Activity

  1. xixingya commented on Jul 26, 2023

    @xixingya
    ContributorAuthor
  2. locked and limited conversation to collaborators on Mar 11, 2024
  3. converted this issue into a discussion #13891 on Mar 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/bugBugs to being fixed

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions