Guice

Guice(发音为 "juice")是一个轻量级的 Java 6 及以上版本的依赖注入框架,由 Google 为您带来。「Guice (pronounced 'juice') is a lightweight dependency injection framework for Java 6 and above, brought to you by Google.」

  • 所有者: google/guice
  • 平台: BSD, Cross-platform, Linux, Mac, Solaris, Windows
  • 許可證: Apache License 2.0
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

Guice

最新版本:5.0.0-BETA-1

文档: 用户指南, 5.0.0-BETA-1 javadocs, 最新的 javadocs
持续集成: Build Status
邮件列表: 用户邮件列表
许可证: Apache 2.0

简单地说,Guice 减轻了对工厂的需求和在 Java 代码中使用 new 的需求。把 Guice 的 @Inject 看作是新的 new。在某些情况下,您仍然需要编写工厂,但您的代码将不会直接依赖于它们。您的代码将更容易更改、单元测试和在其他环境中重用。

Guice 拥护 Java 的类型安全特性,特别是当涉及到 Java 5 中引入的功能时,如属类和注释。你可以把 Guice 看作是为核心 Java 填补缺失的功能。理想情况下,语言本身也能提供大部分相同的功能,但在这样的语言出现之前,我们有 Guice。

Guice 可以帮助你设计更好的 API,Guice API 本身就树立了一个很好的榜样。Guice 不是一个厨房水槽。我们用至少三个用例来证明每个功能的合理性。当有疑问时,我们就不去考虑它。我们构建了通用功能,使您能够扩展 Guice,而不是将每个功能添加到核心框架中。

Guice 的目标是让开发和调试变得更容易和更快,而不是更难和更慢。本着这种精神,Guice 远离惊喜和魔法。无论有没有工具,你都应该能够理解代码,尽管工具可以让事情变得更加简单。当错误确实发生时,Guice 会加倍努力地生成有用的信息。

关于 Guice 的介绍以及与 new 和工厂模式的比较,请看 Bob Lee 的视频演示。之后,请查看我们的 用户指南

自 2006 年以来,我们一直在关键任务应用中运行 Guice,现在你也可以了。我们希望您和我们一样喜欢它。


概覽

名稱與所有者google/guice
主編程語言Java
編程語言Java (語言數: 4)
平台BSD, Cross-platform, Linux, Mac, Solaris, Windows
許可證Apache License 2.0
發布數37
最新版本名稱7.0.0 (發布於 )
第一版名稱1.0 (發布於 )
創建於2014-05-28 23:18:53
推送於2024-04-15 07:38:26
最后一次提交2024-04-15 00:36:44
星數12.3k
關注者數529
派生數1.6k
提交數2.1k
已啟用問題?
問題數1172
打開的問題數314
拉請求數316
打開的拉請求數9
關閉的拉請求數302
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?

Guice

Latest release: 4.2.2

Documentation: User Guide, 4.2.2 javadocs, Latest javadocs
Continuous Integration: Build Status
Mailing Lists: User Mailing List
License: Apache 2.0

Put simply, Guice alleviates the need for factories and the use of new in your Java code. Think of Guice's @Inject as the new new. You will still need to write factories in some cases, but your code will not depend directly on them. Your code will be easier to change, unit test and reuse in other contexts.

Guice embraces Java's type safe nature, especially when it comes to features introduced in Java 5 such as generics and annotations. You might think of Guice as filling in missing features for core Java. Ideally, the language itself would provide most of the same features, but until such a language comes along, we have Guice.

Guice helps you design better APIs, and the Guice API itself sets a good example. Guice is not a kitchen sink. We justify each feature with at least three use cases. When in doubt, we leave it out. We build general functionality which enables you to extend Guice rather than adding every feature to the core framework.

Guice aims to make development and debugging easier and faster, not harder and slower. In that vein, Guice steers clear of surprises and magic. You should be able to understand code with or without tools, though tools can make things even easier. When errors do occur, Guice goes the extra mile to generate helpful messages.

For an introduction to Guice and a comparison to new and the factory pattern, see Bob Lee's video presentation. After that, check out our user's guide.

We've been running Guice in mission critical applications since 2006, and now you can, too. We hope you enjoy it as much as we do.

jolt award

去到頂部