Is it possible to enter the result of a method call from a ref bean from Spring?
I am trying to reorganize some cut / paste code from two separate projects into a common class. In one of the projects, the code lives in a class, which I will call "MyClient", which is created from Spring. It is introduced by another spring -installed class "MyRegistry", then the MyClient class uses this class to find the endpoint. All I really need is the final String in my refactored class, which can be initialized with Setter. I really cannot have a dependency on MyRegistry on MyClient in the updated code.
So my question is ... there is a way that I can insert the end of the line from Spring that was viewed in the MyRegistry class. So, I have a:
<bean id="registryService" class="foo.MyRegistry"> ...properties set etc... </bean> <bean id="MyClient" class="foo.MyClient"> <property name="registry" ref="registryService"/> </bean>
But I would like (and I know this is Spring's imaginary syntax)
<bean id="MyClient" class="foo.MyClient"> <property name="endPoint" value="registryService.getEndPoint('bar')"/> </bean>
where MyRegistry will have a getEndPoint (Stringng endPointName) method
Hope this makes sense in terms of what I'm trying to achieve. Please let me know if something like this is possible in Spring!
java spring
Alex Worden Mar 26 '10 at 1:52 2010-03-26 01:52
source share