title: Is it possible from Spring to inject the result of calling a method on a ref bean?
body: <p>Is it possible from Spring to inject the result of calling a method on a ref bean? </p>
  
  <p>I'm trying to refactor some cut/pasted code from two separate projects into a common class. In one of the projects, the code lives in a class I'll call "MyClient" that is being instantiated from Spring. It is injected with another spring-instantiated class "MyRegistry", then the MyClient class uses that class to look up an endpoint. All I really need is the endpoint String in my refactored class, which can be initialized via a Setter. I really cannot have a dependency on MyRegistry from MyClient in the refactored code. </p>
  
  <p>So, my question is this... is there a way I can inject the endpoint String from spring that was looked up in the MyRegistry class. So, I currently have:</p>
  
  <pre><code>&lt;bean id="registryService" class="foo.MyRegistry"&gt;
  ...properties set etc...
  &lt;/bean&gt;
  
  &lt;bean id="MyClient" class="foo.MyClient"&gt;
      &lt;property name="registry" ref="registryService"/&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>But I'd like to have (and I know this is imaginary Spring syntax)</p>
  
  <pre><code>&lt;bean id="MyClient" class="foo.MyClient"&gt;
      &lt;property name="endPoint" value="registryService.getEndPoint('bar')"/&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>where MyRegistry will have a method getEndPoint(Stirng endPointName)</p>
  
  <p>Hope that makes sense from a the standpoint of what I'm trying to achieve. Please let me know if something like this is possible in Spring!</p>