This code creates a Guice module.
该代码创建了一个Guice模块。
Tell Guice which dependency you want.
告诉Guice您需要哪个依赖项。
Guice: Download the Guice 2 beta release.
Guice:下载Guice2beta发行版。
Guice is a dependency injection (DI) framework.
Guice是一个依赖项注入(DI)框架。
I hope you'll consider adding Guice to your toolkit.
我希望您会考虑将Guice添加到工具包中。
At that time they can safely become Guice managed.
到那个时候,它们就能安全地变为由Guice管理的了。
Finally, Sitebricks is built directly on top of Guice.
最后,我想说的是Sitebricks直接构建在Guice之上。
Guice calls this method immediately after it constructs my hero.
Guice会在构造好hero之后立即调用此方法。
If you're familiar with Guice, the code above should look familiar.
如果您熟悉Guice,上述代码应该会看起来很眼熟。
Developers have contributed Spring, Seam and Guice service adapters.
开发人员已经编写了Spring、Seam、Guice服务适配器等。
You will not have to create or edit a lot of XML files to use Guice.
要使用Guice,不需要创建或编辑大量XML文件。
By default, Guice creates a new instance of each dependency you ask for.
默认情况下,Guice为每个请求的依赖项创建一个新实例。
This means it won't interfere with applications' use of Spring, Guice, etc.
这就意味着它不会影响应用使用Spring、Guice等。
The @Inject tag takes on meaning only when you ask Guice to construct your class.
@Inject标记只在您要求Guice构建类时才有意义。
Write your business logic with session beans, Spring, Guice, or Pojo services.
用会话Bean、Spring、Guice或Pojo服务写业务逻辑。
This is the first way of getting Guice to construct your objects: asking explicitly.
这是Guice构造对象的第一种方式:显式询问。
Guice automatically injects the provider method in Listing 15 with the correct arguments.
在清单15中,Guice自动使用正确的参数注入provider方法。
Dhanji: Sure, the primary principles are conciseness and type-safety, just like Guice.
Dhanji:当然可以。主要的原则就是简洁与类型安全,就像Guice那样。
I think Dependency Inversion is so important that I want to invert the dependencies on Guice!
我认为依赖倒置非常重要,因此打算转换对Guice的依赖。
If you don't ask Guice to create FrogMan, the annotation has no effect on the code's behavior.
如果不要求Guice构建FrogMan,这个注释对代码行为就没有任何影响。
Provider methods are an excellent way to integrate other libraries into your Guice module.
provider方法是将其他库集成到Guice模块中的很好方式。
It turns out that Guice can bind constant values as well as new instances. Check out Listing 21.
Guice可以绑定常量值和新实例。
Like Guice, it makes aggressive use of annotations to keep configuration as part of the code.
它像Guice一样大量使用注释将配置作为代码的一部分。
To keep the work manageable, you can store the Guice Injector somewhere and call it directly.
为了使工作易于管理,可以将Guice Injector存储在某处并直接调用它。
If you are using an IOC model already (Guice, Spring etc.) then migrating is usually a lot easier.
如果你已经使用了IOC模型(Guice, Sprint等等),那么通常迁移会容易得多。
Now that Guice knows that your hero needs a Vehicle, it needs to know which Vehicle to provide.
Guice知道您的hero需要一个Vehicle后,它需要知道提供什么Vehicle。
The binding annotation is necessary here because otherwise, Guice couldn't tell different Strings apart.
这里有必要使用绑定注释,否则Guice将不能区分不同的String。
You rely on Guice to provide your dependencies, even when you're configuring your Guice module itself.
您依靠Guice来提供依赖项,即使是配置Guice模块本身。
The Binder that Guice passes to your module lets you tell Guice how you want your objects constructed.
Guice传递给模块的Binder 用于告诉 Guice您想如何构造对象。
Guice and other DI frameworks serve as flexible "super factories" that you configure to build your objects.
Guice和其他DI框架可作为“超级工厂”,您可以通过配置它们来构建对象。
应用推荐