Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

component依赖文件生成插件异常 #18

Open
duguyixiaono1 opened this issue Aug 22, 2018 · 0 comments
Open

component依赖文件生成插件异常 #18

duguyixiaono1 opened this issue Aug 22, 2018 · 0 comments

Comments

@duguyixiaono1
Copy link

duguyixiaono1 commented Aug 22, 2018

版本:framework-bom 4.0.0
注解:@ Named、@ Inject
方法:AbstractResourceConfigurator:A(Class clazz)

异常:
image

单测例子:
``
public class ComponentsConfiguratorTest {

@Test
public void testA() {
    TestComponentsConfigurator testComponentsConfigurator = new TestComponentsConfigurator();
    List<Component> components = testComponentsConfigurator.defineComponents();

    String content = Configurators.forPlexus().generateXmlConfiguration(testComponentsConfigurator, components);
    System.out.println(content);
}

class TestComponentsConfigurator extends AbstractJdbcResourceConfigurator {
    @Override
    public List<Component> defineComponents() {
        List<Component> components = new ArrayList<>();

        // method1
        components.add(A(TestComponent.class));

        // method2
        // components.add(A(TestImpl.class));
        // components.add(C(TestComponent.class).req(TestImpl.class));

        return components;
    }
}

interface ITest<T> {
    void test(T t);
}

@Named(type = ITest.class, value = "test")
class TestImpl implements ITest<List<String>> {
    @Override
    public void test(List<String> strings) {

    }
}

@Named
class TestComponent {

    @Inject("test")
    private ITest<List<String>> t;
}

}
``

原因:
image
image
@ Inject修饰的范型类型为范型时,会抛这个异常

解决方式:
通过单测例子注释中的method2可以绕过去

疑惑:
但是,在foudation-service 2.7.6版本中,上述单测是没问题的,这种升级导致的异常,属于正常feature吗?

@duguyixiaono1 duguyixiaono1 changed the title component依赖注入异常 component依赖文件生成插件异常 Aug 22, 2018
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

No branches or pull requests

1 participant