PK Z>Yf build.xml
PK c>nYS S manifestversion=1.1.1
frameworkVersions=play-core e2c434d4e1fbbccfa3357d181614fc795f8e9e90
PK Z> READMEPK Z>nc;
! documentation/manual/home.textileh1. Guice module
The Guice module helps you to inject Guice managed components into your play application. The injection points are defined by the upcoming **@javax.inject.Inject** annotation, which is bundled with play at the moment.
There are two ways to use the module: you either can define your own injector (which can be useful if you have an existing injector or if you want to have full control over your modules) or play will scan the classpath for classes that implement **com.google.inject.AbstractModule** and inject based on these modules.
h2. Enable the Guice module for the application
You can enable the Guice module by adding the following line to your application's **/conf/application.conf** file:
bc. module.guice=${play.path}/modules/guice
(if you are using a standard **application.conf** the line above should be already there, you will just need to uncomment it)
h2. Defining a Guice injector
Defining a custom injector is easy, you just need to implement the **play.modules.guice.GuiceSupport** interface. For example:
bc. package utils;
import play.modules.guice.GuiceSupport;
import com.google.inject.*;
public class GuicyDummy extends GuiceSupport {
protected Injector configure() {
return
Guice.createInjector(
//your modules should come here
);
}
}
After defining this class play will use the injector defined in the **configure** method to inject into your application's Controller, Job and Mail classes (based on **@javax.inject.Inject**).
h2. Using AbstractModules
Alternatively, play will scan the classpath for classes that implement AbstractModule.
For example:
bc. package utils;
import com.google.inject.*;
public class GuicyDummy extends AbstractModule {
public void configure() {
//your bindings should come here
}
}
In this case play will pick up this module and inject it into your application's Controller, Job and Mail classes (marked by **@javax.inject.Inject**). Note, the custom injector strategy will always take precedent.
h2. Inject classes other than Controller, Job and Mail
In order to inject classes that are neither controller nor Job and Mail, you need to annotate the class with play.modules.guice.InjectSupport annotation.
For example:
bc. package models
import play.db.*
import play.modules.guice.*
import javax.inject.*
@InjectSupport
public class MyModel extends Model {
@Inject
static MyService service;
}
h2. Limitations
The Guice module is not playing well with the Spring one, so please make sure you activate only one of them. It's also worth mentioning that right now, following play's convention, injection is working for static fields only.
PK Z>v9s s lib/aopalliance.jarPK
"ws0 META-INF/PK !ws0 META-INF/MANIFEST.MFMLK-.
K-*ϳR03rCq,HLHU %MLxRKRSt*AL
u4K|3+KRs<4yx PKY``]_ k PK
"ws0 org/PK
"ws0 org/aopalliance/PK
"ws0 org/aopalliance/aop/PK
"ws0 org/aopalliance/intercept/PK "ws0 org/aopalliance/aop/Advice.class;o>}vv&FtĜļT[1,39A +,Q?'1/]?)+5+8(9-3'VX$ PK3e q PK "ws0 ) org/aopalliance/aop/AspectException.classuSkS@=KiCP<)" AFP@G>htǿRʌQwBK[swo= m3Lhig+"z_Y-a43ޕm*{K%3;5ܾZv. <35`C|1r`PsB؎erᘻFA(nnT-)Etsq~/ۯ3RCøM[UX6,dŐ;uy<^P c
bOBJjGP$%gmaPmi@;5r])my/j
o^\BW0 9Ofr\OޢO)>aH4W˧AsWaX CUPx$mNpWJIˈKXM
#4V%l4]5"tBƺ0izU&/E\wnoZymF1N
BJڵWsZ#IQQZbiE1R25B(!]8*tΟ!t{? 2] c'MUI.Q