PK 0qK2Y% % manifestversion=1.10
frameworkVersions=1.5.+
PK .qKǘ README## Changelog
### 1.10
Move creation of guice injector from `onConfigurationRead()` to `onApplicationStart()`.
We found that method `onConfigurationRead()` can be called many times during application lifetime (on every application.conf change).
It causes creating multiple instances of guice injector, thus causing memory leaks.
### 1.9
* Added guava 23.0 dependency (Guice actually doesn't work without it)
* upgrade to play 1.5.1 (which adds methods Injector.setBeanSource() and automatically injects controllers' instances)
### 1.8
* upgrade to play 1.5
### 1.7
* create request.controllerInstance even if action method is static
### 1.6
* upgrade guice to 4.1.0 and include multibindings
### 1.5
* support injecting of non-static dependencies into controllers
### 1.4
* upgrade to guice 4.0
### 1.3
* support both javax.inject.Inject and com.google.inject.Inject annotations
* first search for custom injectors, and only then - for Modules. (the previous code depended on order of classes: which of them meets first in classpath)
### 1.2
* copy of play-guice 1.2 plugin
(taken from https://www.playframework.com/modules/guice)
Initial github project seems to be dead: http://github.com/pk11/play-guice-modulePK jJ
W1 build.sh#!/bin/bash
ORGANIZATION="play-guice"
MODULE="guice"
VERSION=`grep self conf/dependencies.yml | sed "s/.*$MODULE //"`
DESTINATION=/var/www/repo/$ORGANIZATION
TARGET=$DESTINATION/$MODULE-$VERSION.zip
rm -fr dist
play dependencies --sync || exit $?
play build-module || exit $?
if [ -d $DESTINATION ]; then
if [ -e $TARGET ]; then
echo "Not publishing, $MODULE-$VERSION already exists"
else
cp dist/*.zip $TARGET
echo "Package is available at https://repo.codeborne.com/$ORGANIZATION/$MODULE-$VERSION.zip"
fi
fi
PK jJFk k build.xml
PK jJnc;
! 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 ; lib/jsr305-1.3.9.jarPK
(: META-INF/ PK
(:$9\ j META-INF/MANIFEST.MFMLK-.
K-*ϳR03rCq,HLHU %AE%)N zI
y
Eŕ%
yz\\ PK
t(: javax/PK
t(: javax/annotation/PK
t(:ix" # javax/annotation/CheckForNull.classNB1r;7P1v9*e9Ri
\ >q0FHؤi3!6vB';EY@ ;J#g
Y8qc}9]",cVr|-_PK
t(:?' % javax/annotation/CheckForSigned.classN1rZ^tWx !5^enkʫyPYCD&Lәo `A@iOU@GjM9X
l{*;5R*Z+2z$pp0n uו߂{n($ms"żFkri,=Le땇-=ܐe? ?ǻmju~}gb9v5~HQѰaloW>vR43t@wJ#g
Y8p\`}9]!b
Vr|]>PK
t(:GގU _ ' javax/annotation/CheckReturnValue.classRKO@E
>@EgOMGJJOKX(̓?e F=:"\zG(ޡ9_{GFctR x g}Qc~%E oBz#l{\n )\7xGj(*1Ѹʙ=z\YeiӪ7e:Mr
a7%EGdqQDT 5UwkZ5֟3cZ!BA0Z_$(KR@`K i%._!- LVue6`SrPK
t(:8K javax/annotation/Detainted.classMO1uPI7x e<QYC56ig;|{pl;Q<Bi4Je,ݟe"vXҭ&ϘJ"38jyt\pQ8}3?`D&
وg{w>YD'^GZS~vyy.?ii؝>M,zP4n`ddH\w>[`H8P#]y̡K/X*k
Qe
PK
t(:< - javax/annotation/MatchesPattern$Checker.classT[W@bCZ@.\DhK! ދh SP,}[Ӕ(,Py}3/ тx3d$\11P1pOHx(CӴnC0(0ֺ`hXׄډ,nwm3
- 탰vDnopGLu;ZITp9TC̊M*/^jp^>C,I2>@C~L^m1tUG7T[ŎzUNd 3qEn$C$MTm*A:GjӖXrCЅMC_eO7lU51v:`%PЊ^/pew#$p)%}
O}&N>>wϬߏ:◩1C)~Szpv PK
t(:X1Fe % javax/annotation/MatchesPattern.classQNA}⸠+.ʼngO4!c16=dy(c
!C*{U6l:pj])(4eS,:!JIHWK-)
lxG*VΌ *4](]o\`oP=Kv0iGV>&RqkK^
,zYV!@nByc]s (8ȷá -cg8һgr\p5~98^.`MK.1d
V9qkXg
0@#oPK
t(:, : * javax/annotation/Nonnegative$Checker.classT]OA=.,.
Z,BJZLSGJEe).nLƈWw-"Ud5g쏟_ǂVD`ac\q"&}IP# -x,bJDD4Cfhv2&5CMv2dtB:fVӊeP7<T۪ /ju%WJn)Ee/i+fI9rXmô⦑N+zru##^lY;<JxmS5S`#CojQ"+P,5\K#r)PU?koy8gE]7k]PjTPtmCS-m]MkHQYjBVÎP OD<S*4g 14{2#NsZ2f0+#9<^2qaL%Bk1JͦgI'(Rf6U(Ф5Xr-rEh>)ntC^alϴq*NZ#˸`@8:#cB|)t4x}(BpG1ǩ2%|Bj*SCR9(;$iHzq_7BCы[1=vθ&I?i~^Wvtʲ|*J%vlSm1=XyC9t棿jWT!pǩFbر#tRҳPK
t(:dF}W s " javax/annotation/Nonnegative.classRNB1"pQ э7]ЄQ%. K/_sQ#1B"isf:32m c +`d=+(kMnіG@KZ`ғCbJ_f|i6\ U/Q[/;$Z4ux \.Mɪ:LW@h_^yeD5L[δNɱ>iYрni"y 9ʒpSA5֫jbJd(oz؈]Q~J4ngjL"~@fOXdc!ı !,c,ULJYHc
l"qa>PK
t(:v s &