On 2/26/07, Konstantin Priblouda <[EMAIL PROTECTED]> wrote:

I would  ask why to prefer guice over
pico/nanocontainer instead ;)


Type checking, performance, documentation, less code, generic types support,
cleaner configuration (Guice uses a nice EDSL), no setter method
requirement, up front error checking with user friendly messages, simpler
API...

IMHO, Annotations are cool and sexy, but they are not
usefull in this context as they are bound to compile
time.


So are interfaces. :)

What's important is that you don't depend on the implementation. Depending
on the interface and annotation is OK. Strings are a pain.

I have some generic tools / frameworks  which I like
to integrate in a webapp (for example,
user management, security and menu system:
http://www.sourceforge.net/projects/jtec)

And some of those tools need ( say ) hibernate
session.
But I have more than one hibernate session in my
web application.

If my wiring is configured via annotations ( compile
time )  I'm lost - I have to recompile my rfamworks
just to be used in some project.


This is where custom providers come in. You inject the provider and then
create your object. If you provide a more detailed example, I'll provide a
code example.

Thats where externalized configuration rules.
( and pico contaienr supports not only xml , but also
groovy and other scriupting configuration  )


Guice supports properties files and can convert the types at startup. I also
see no reason why you couldn't implement Module using Groovy.

Bob

Reply via email to