Comment by florin.jurcovici:
IMO, guice's weakness is that it doesn't support XML configuration files at
all. With Spring, you have a choice. You can go for in-code configuration,
where you do all the wiring in a class (which is IMO more comprehensible
than guice annotations, and still perfectly testable by the compiler, from
the POV of type safety), you can use annotations for doing the wiring
(admittedly, less powerful than what guice provides), or you can just use
plain old XML files. With guice, somebody else already made the choice for
you: it has to be annotations all the way. You don't have an option even
for classes you don't own and which you can't annotate. You just have a
workaround: the @provider annotation.
It is probably significantly faster to start up a guice application, since
all the interpretation of dependency information can happen at compile
time, whereas with Spring, gathering and merging the dependency information
from all the various places where it might hide might take a while. But I
don't expect significant performance differences after startup, for guice
and spring applications doing the same thing, since the only significant
difference, once the wiring is done, is how aspects are applied (as far as
I can understand this) - you simply have more calls placed on the stack
with spring, but essentially the same code is executed. Since both
frameworks are used mainly for server-based apps, I don't see this as a
significant advantage for guice.
I also don't see spring's comprehensive technology stack as a significant
advantage either. Besides transaction management and generic AOP for
logging, I usually don't use much more than spring core, since (again,
somebody else said it already) their UI-related components are outdated,
and (as far as I know) there is no ready-made JSON-RPC server-side
component in the spring technology stack. Besides, you can easily integrate
non-Spring components for various jobs in your application - via the XML
files, if you find better solutions than what the spring technology stack
provides.
For me, all things considered, the signficant argument for spring and
against guice is that I frequently have to include classes for which I
don't control the source code, and where I can't add annotations by hand. A
strictly annotation-based mechanism in such a case is IMO less convenient.
Just my two cents.
For more information:
http://code.google.com/p/google-guice/wiki/SpringComparison
--
You received this message because you are subscribed to the Google Groups
"google-guice-dev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-guice-dev?hl=en.