Bonjour,
Je voudrais savoir si c'est possible d'injecter un bean managé :
Dans une ressource PushEndpoint :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3 @Named [javax.inject.Named] @ApplicationScoped [javax.enterprise.context.ApplicationScoped] public AppManager implements Serializable {[...]}
Car je n'arrive pas à le faire fonctionner
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5 @PushEndpoint("/myPath") [org.primefaces.push.annotation.PushEndpoint] @Singleton [org.primefaces.push.annotation.Singleton] public class PushRessource { <div style="margin-left:40px"> //Avec</div><div style="margin-left:40px"> @Inject</div><div style="margin-left:40px"> private AppManager appManager;</div> <div style="margin-left:40px"> @OnClose</div><div style="margin-left:40px"> public void onClose(RemoteEndpoint r, EventBus eventBus) {</div><div style="margin-left:40px"><div style="margin-left:40px"> //appManager est toujours null</div></div><div style="margin-left:40px"><div style="margin-left:40px"> appManager.test();</div></div><div style="margin-left:40px"> }</div>}
pom.xml :
Merci d'avance
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 <dependencies> <div style="margin-left:40px"> <dependency></div><div style="margin-left:40px"><div style="margin-left:40px"> <groupId>org.atmosphere</groupId></div></div><div style="margin-left:40px"><div style="margin-left:40px"> <artifactId>atmosphere-runtime</artifactId></div></div><div style="margin-left:40px"><div style="margin-left:40px"> <version>2.3.0-RC6</version></div></div><div style="margin-left:40px"> </dependency></div><div style="margin-left:40px"> <dependency></div><div style="margin-left:40px"><div style="margin-left:40px"> <groupId>org.primefaces</groupId></div></div><div style="margin-left:40px"><div style="margin-left:40px"> <artifactId>primefaces</artifactId></div></div><div style="margin-left:40px"><div style="margin-left:40px"> <version>5.2</version></div></div><div style="margin-left:40px"> </dependency></div><div style="margin-left:40px"> <dependency></div><div style="margin-left:40px"><div style="margin-left:40px"> <groupId>javax</groupId></div></div><div style="margin-left:40px"><div style="margin-left:40px"> <artifactId>javaee-web-api</artifactId></div></div><div style="margin-left:40px"><div style="margin-left:40px"> <version>7.0</version></div></div><div style="margin-left:40px"><div style="margin-left:40px"> <scope>provided</scope></div></div><div style="margin-left:40px"> </dependency></div></dependencies>
Partager