Dear Karaf team,

I have a problem with blueprint static factories.

I made a class I use as a static factory:
            <bean id="testfactory" class="test.TestFactory" 
factory-method="staticFactory"/>

Then I try to inject testfactory to another bean as an argument:
            <bean id="testbean" class="test.TestBean">
                        <argument ref="testfactory"/>
            </bean>

The factory class is like this:

public final class TestFactory implements TestInterface {
            private static final TestInterface FACTORY= new TestFactory();

            private TestFactory() {}

            public TestInterface staticFactory() {
                        return FACTORY;
            }

The TestBean constructor like that:

public final class TestBean {
            public TestBean(final TestInterface test) { ...}
}

This fails stating that no constructor can match. However:
* if I add a TestBean constructor taking an Object as argument, this test 
succeeds
* if I construct a bean implementing TestInterface, the constructor (taking 
TestInterface) is found.

I don't know what can be the problem. Is this kind of trouble already known?

PS: TestInterface is in fact using generics

Cheers,
JP

[@@ OPEN @@]

Reply via email to