Spring和Guice在一起,或者只是Spring [英] Spring and Guice together, or just Spring

查看:241
本文介绍了Spring和Guice在一起,或者只是Spring的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从头开始创建一个新的Java Web应用程序。

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

我对Spring Framework没有太多经验,但我知道我想使用它的一些功能,例如Transaccions Management。

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.

另一方面,我非常喜欢Guice的依赖注入。

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

我知道Guice和Spring可以一起工作: http://www.jroller.com/mindcrime/entry/an_example_of_integrating_guice

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.

另外,我真正喜欢Guice的是你不需要XML配置文件,只需要java模块,它更短,更容易阅读。在Spring上有没有替代XML配置文件的方法,类似于Guice?

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?

推荐答案

我认为仅Spring就足以应对企业应用。

I think Spring alone is good enough for enterprise application.

Spring dosent也需要XML! Modern Spring Apps使用 JavaConfig 最小化配置。请查看 Spring Boot Guides 。 Whole Spring应用程序根本不能使用任何XML。

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很好,但非常有限。使用Spring可以非常简单快速地编写具有事务和持久性的Web应用程序或REST应用程序。有了Guice,这就更复杂了。

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.

这篇关于Spring和Guice在一起,或者只是Spring的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆