I have the following java classes
public class SecondClass
{
//...
}
public class MyClass
{
public void doSomething(SecondClass secondClass)
{
//...
}
}
In blueprint I have something like the following
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
<bean id="secondClass" class="foo.bar.SecondClass" />
<bean id="myClass" class="foo.bar.MyClass" />
<!-- How do I invoke myClass.doSomething(secondClass) ??? -->
</blueprint>
Someone knows how to call myClass.doSomething(secondClass) from inside Blueprint?
If I understand correctly (not being very familiar with the MethodInvokingFactoryBean myself) what you need is a factory method, ie. something like the following:
<bean id="myClass" class="foo.bar.MyClass"
factory-method="doSomething">
<argument ref="secondClass"/>
</bean>
You can find more details on how to use factories with blueprint in this guide (one of the most useful blueprint resources IMO)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With