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.」

  • Owner: google/guice
  • Platform: BSD, Cross-platform, Linux, Mac, Solaris, Windows
  • License:: Apache License 2.0
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

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,现在你也可以了。我们希望您和我们一样喜欢它。


Overview

Name With Ownergoogle/guice
Primary LanguageJava
Program languageJava (Language Count: 4)
PlatformBSD, Cross-platform, Linux, Mac, Solaris, Windows
License:Apache License 2.0
Release Count37
Last Release Name7.0.0 (Posted on )
First Release Name1.0 (Posted on )
Created At2014-05-28 23:18:53
Pushed At2024-03-20 21:38:37
Last Commit At2024-03-20 14:37:38
Stargazers Count12.3k
Watchers Count530
Fork Count1.7k
Commits Count2.1k
Has Issues Enabled
Issues Count1172
Issue Open Count314
Pull Requests Count314
Pull Requests Open Count9
Pull Requests Close Count301
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private

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

To the top