struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexandru Popescu" <the.mindstorm.mailingl...@gmail.com>
Subject Re: Guice 1.0rc2
Date Mon, 26 Feb 2007 17:16:13 GMT
On 2/26/07, Bob Lee <crazybob@crazybob.org> wrote:
> On 2/26/07, Konstantin Priblouda <kpriblouda@yahoo.com> wrote:
> >
> > Hi Bob,
> > I'd like to say that I'm codeveloper of
> > pico/nanocontainer.
>
>
> I've used Pico and Nano. Nano uses my AOP framework. You should try Guice.
>
> > What's important is that you don't depend on the
> > > implementation. Depending
> > > on the interface and annotation is OK. Strings are a
> > > pain.
> >
> > We do not depend on string keys to dientify components
> > - key in container  is just object, and is
> > needed only in case of ambiguity ( but it could be
> > string as well )
>
>
> Using these key objects is more verbose than using annotations with Guice.
>
>
> > Basically I just register this session component -
> > and my HibernateUserManager receives it in
> > constructor.
> >
> > Why do I need an annotation to achieve this?
>
>
> The annotation indicates which constructor you want injected (to the
> framework as well as other programmers). What happens if you forget to
> configure a PasswordHasher in Pico? No hashing? That's not very secure.
>
> If you can't annotate a constructor (because you don't control the code),
> you can use a custom provider. For example:
>
> class HibernateUserManagerProvider implements Provider<HibernateUserManager>
> {
>   @Inject Session session;
>   @Inject PasswordHasher passwordHasher;
>   public HibernateUserManager get() {
>     return new HibernateUserManager(session, passwordHasher);
>   }
> }
>
> Well, there is still a question why it is better than
> > pico ;)
>
>
> Write less code, and get better up front checking and better performance.
> What more do you want?
>
> Bob
>

Bob it sounds cool, but without documentation I would say that there
are not many chances people will look into it. I will wait for the
moment the documentation becomes available.

./alex
--
.w( the_mindstorm )p.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Mime
View raw message