dougman82
Apr 28th, 2011, 11:54 AM
So, to simplify things... let's say I've got a ProcessorBean that does some simple data processing. Then, I have some other beans BeanA, BeanB, and BeanC that need to use that data processing. So currently, in my XML configuration file, I wire up those other beans so that they have a reference to ProcessorBean. Then, inside those other beans, I can simply call the relevant methods of ProcessorBean to get the necessary data.
Well now, I am working with a 3rd-party class of which I do not have access to the source. This class also needs to utilize the data processing provided by ProcessorBean. However, since I do not have the source, I cannot adjust it to accept an instance of any other bean. All I have to work with are some basic setter methods.
Is there a way, upon creation of this new bean, to set a property as the return value of a method in ProcessorBean? I took a look at MethodInvokingFactoryBean, and it seems like it will get the job done, except that, unless I'm mistaken, it creates a whole new instance of the bean in question. ProcessorBean already exists and is being used elsewhere in the project. I just need to access a method. Can this be done?
Any help is appreciated.
Well now, I am working with a 3rd-party class of which I do not have access to the source. This class also needs to utilize the data processing provided by ProcessorBean. However, since I do not have the source, I cannot adjust it to accept an instance of any other bean. All I have to work with are some basic setter methods.
Is there a way, upon creation of this new bean, to set a property as the return value of a method in ProcessorBean? I took a look at MethodInvokingFactoryBean, and it seems like it will get the job done, except that, unless I'm mistaken, it creates a whole new instance of the bean in question. ProcessorBean already exists and is being used elsewhere in the project. I just need to access a method. Can this be done?
Any help is appreciated.