Spring and Guice together, or just Spring

csalazar picture csalazar · Jan 11, 2014 · Viewed 16.8k times · Source

I'm starting a new Java web app from scratch.

I don't have much experience on Spring Framework, but I know I'd like to use some of its features, such as Transaccions Management.

On the other hand, I really like Guice for dependency injection.

I know that Guice and Spring can work together: http://www.jroller.com/mindcrime/entry/an_example_of_integrating_guice

But before starting designing my application, I wanted to know if someone had experienced issues by following that approach.

Also, what I really like from Guice is that you don't need an XML configuration file, but just java Modules, which shorter and are easier to read. Is there any alternative to XML configuration files on Spring, similar to Guice?

Answer

MariuszS picture MariuszS · Jan 11, 2014

I think Spring alone is good enough for enterprise application.

Spring dosent need XML too!!! Modern Spring Apps uses JavaConfig and minimal configuration. Take look at Spring Boot Guides. Whole Spring apps can not use any XML at all.

Guice is nice, but very limited. With Spring is possible to write web application or REST application with transactions and persistance very easy and fast. With Guice this is more complicated.