Guice vs Spring Boot

时间:2017-07-23 21:54:45

标签: spring spring-boot guice

有人对我说,Guice是一个宁静的微服务的更好选择。

我说......

Spring Boot提供:

- Core Spring Support - DI + AOP 
- Auto-Configuration: Web, Rest, Data, etc
- Activation Profiles: activate bits of code based on profiles 
- Simplified Web Development: code driven, no xml, no web.xml etc
- Web Testing Support: successful testing is easy testing
- Security Support: out of the box that can be customized
- JMS: out of the box support and can be excluded if not needed
- Actuator: health, trace, beans, info + much more etc 
- Executable and deployable WARs
- Natural fit for restful micro-services
- Fast loading
- extensible, native cloud support and much more

在真实的Web应用程序中,这些是开发期间和部署到生产后所需的类型功能。

Guice-rs抱怨Spring的旧版本,加载速度慢,编程错误等问题等等。

从我的阅读材料中,Guice是为超大型应用程序创建的,这些应用程序有许多开发人员在使用它们,在这种情况下使用像Spring这样的东西可能需要更长时间才能加载。 Guice是一个DI框架,可以让您对如何快速加载应用程序代码进行细粒度控制。

现在我还没有使用Guice并且还不认识Guice,有人可以组建Guice阵营教育我Guice是否/如何提供上述功能。

非常感谢!

1 个答案:

答案 0 :(得分:2)

Spring Context是提供"核心弹簧支持 - DI + AOP"你之前提到过的。该列表中的其他功能由其他弹簧包提供。 Spring boot将它们全部包装成一个自动配置包。

TL; DR spring-context类似于guice,guice本身并不包括你名单上的其他项目。