That will work, but doesn't enforce your intent on other developers
(they would be free to inject the ASO as a SessionDAO and not an
ISessionDAO).  Perhaps a better way would be to create a service whose
sole purpose would be to retrieve an instance of the ISessionDAO from
the ApplicationStateManager, which can be auto-wired to your
ISessionDAORetriever service.  Noone would then know the type.

-Mike

On 3/16/06, Adam Zimowski <[EMAIL PROTECTED]> wrote:
> Silly me :-)  How simple and elegant !  I've been thinking in the
> spring context, yet Tap/Hivemind make it so simple..
>
> Thanks!
>
> On 3/16/06, Kristian Marinkovic <[EMAIL PROTECTED]> wrote:
> > hi Adam,
> >
> > @InjectState("sessionDAO")
> > public abstract ISessionDAO getSessionDAO();
> >
> > works fine too; i'm using it with tapestry-spring
> >
> >
> >
> >
> >              "Adam Zimowski"
> >              <[EMAIL PROTECTED]
> >              .com>                                                      An
> >                                         "Tapestry users"
> >              16.03.2006 14:11           <[email protected]>
> >                                                                      Kopie
> >
> >               Bitte antworten                                        Thema
> >                     an                  POJO dependency injection (with
> >              "Tapestry users"           interface) into TAP4 application
> >              <[EMAIL PROTECTED]
> >              karta.apache.org>
> >
> >
> >
> >
> >
> >
> >
> >
> > Hi there,
> >
> > I'd like to inject my DAOs from Hivemind as an interface such that my
> > app is not aware of implementation. I only know I can do this:
> >
> > <contribution configuration-id="tapestry.state.ApplicationObjects">
> >  <state-object name="sessionDAO" scope="application">
> >   <create-instance class="data.dao.SessionDAO"/>
> >  </state-object>
> > </contribution>
> >
> > Then, in my class I'd do:
> >
> > @InjectState("sessionDAO")
> > public abstract SessionDAO getSessionDAO();
> >
> > I have a few problems with this:
> >
> > 1) I'd like to inject an interface ISessionDAO, not the concrete
> > implementation.
> >
> > 2) Question: will Hivemind give me a singleton? I don't want my DAO's
> > be a bunch of short lived objects. I'd like to be sure they are
> > singletons. I think they are because the scope is application, but I'm
> > not sure.
> >
> > 3) I'd like to be able to inject it to other POJOs, not just Tapestry
> > derived objects (pages, components, etc). I probably could use
> > Registry object, but I really prefer to do this with annotations? They
> > are so elegant.. Does Hivemind has annotation support ?
> >
> > As always, I appreciate your help up front.
> >
> > Regards,
> > Adam
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to