Nov 10th, 2012, 10:46 AM
BeanDefinitionBuilder and problem to call initialize method with parameter
i started writing a custom namespace for a 3rd party key-value store project. All in all i understand how the NamespaceHandler and AbstractSingleBeanDefinitionParser thingy works. But i have one problem. The 3rd party class which i need to instantiate (or which spring needs to instantiate for me) has a no-arg constructor (this is fine) but needs a call to a initialize(Configuration conf) method.
Of course i built the needed Configuration object in my BeanDefinitionParser but i dont know how to tell the BeanDefinitionBuilder (bdb) to call this for me with the Configuration Object i created. At first i thought about using bdb.setInitMethodName(String) but i cant supply a parameter to that init-method. I also cant use bdb.addPropertyValue(String, Object) because i dont have a setConfiguration() method in this 3rd party class but the mentioned initialize(Configuration) method.
I know there must be some way to achieve this. I could ask the 3rd party project to make the Bootstrap class more spring friendly but this looks bad ;-) I want to solve it with Spring.
Anyone an idea?