此内容没有您所选择的语言版本。
6.4. Using Guice With the Microcontainer
The focus of Guice is type matching. Guice beans are generated and configured using Modules.
Example 6.4. Deployment Descriptor for Guice Integration In the Microcontainer
Two important parts to watch from this file are
PojoModule
and GuiceKernelRegistryEntryPlugin
. PojoModule
configures your beans, as in Example 6.5, “Configuring Beans for Guice”. GuiceKernelRegistryEntryPlugin
provides integration with the Microcontainer, as shown in Example 6.6, “Guice Integration with the Microcontainer”.
Example 6.5. Configuring Beans for Guice
Example 6.6. Guice Integration with the Microcontainer
Note
An
Injector
is created from the Modules
class, then does a look-up on it for matching beans. See Section 6.5, “Legacy MBeans, and Mixing Different Component Models” for information about declaring and using legacy MBeans.