You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Miguel Angel Hernández <mi...@gmail.com> on 2007/03/14 19:32:39 UTC

Re: Injecting hivemind properties into spring beans

Ben,

Its been some time but I'm curious, why a Singleton?

cheers,

miguel

On 12/14/06, Ben Gidley <be...@gidley.co.uk> wrote:
>
> This is quite easy to do you create Spring factory bean that provides the
> service
>
> To make this work I cheated an chucked the registry onto a Singleton. I
> suspect other strategies are possible.
>
> e.g.
> public class HivemindFactoryBean implements FactoryBean {
>
>     private String serviceId;
>
>     private Class serviceInterface;
>
>     public Object getObject() throws Exception {
>         return RegistryManager.getInstance().getRegistry().getService(
>                 serviceId, serviceInterface);
>     }
>
>     public Class getObjectType() {
>         return serviceInterface;
>     }
>
>     public boolean isSingleton() {
>         return true;
>     }
>
>     public String getServiceId() {
>         return serviceId;
>     }
>
>     public void setServiceId(String serviceId) {
>         this.serviceId = serviceId;
>     }
>
>     public Class getServiceInterface() {
>         return serviceInterface;
>     }
>
>     public void setServiceInterface(Class serviceInterface) {
>         this.serviceInterface = serviceInterface;
>     }
>
> }
>
> On 12/13/06, Miguel Angel Hernández <mi...@gmail.com> wrote:
> >
> > Stefan,
> >
> > How did this turned out?
> > I ran into a similar problem, and found this link very usefull:
> >
> > http://hivemind.apache.org/hivemind/BuilderFactory.html
> >
> > Indeed injecting spring services in hivemind's is fairly easy, though
> > backwards is'nt...
> >
> > Miguel
> >
> >
>