tom-jb [
https://community.jboss.org/people/tom-jb] created the discussion
"Inter-module injection - the easy way (or even any way or alternative
approaches)?"
To view the discussion, visit:
https://community.jboss.org/message/774712#774712
--------------------------------------------------------------
I am trying unsuccessfully to get Inter-module injection working. I expected that I could
have a cdi-enabled war @Inject beans from a bean archive in the same container after haing
added a dependency to the bean-archive-as-module in the war's
jboss-deployment-structure.xml file
My ultimate goal is to enable a rapid development process for our team where developers
working on the front end redeploy just a lean war that does not contain any backend
services but has a module dependency on a "services" deployable (which is
currently an ear but could be just a jar if need be). Devs doing front-end work would
ideally just @Inject any local dependency located in the services deployable with
minimal/zero per-service configuration fuss. The services deployable is a fairly
time-consuming redeploy, and a frequent redeploy seems unneeded for developers just doing
front-end work.
Normally, I might have liked to accomplish this goal by using an exploded ear, where the
war is part of the ear, and the front end developer can just redeploy the war portion of
the ear after making,say, a java file change, and only the war is redeployed, not the
entire ear (which again is slow and seemingly unneeded). Other apps servers that I've
worked with in the past offer this specific functionality, but it appears that AS7 does
not (unless, hopefully, I'm wrong). On AS7 it seems only the entire ear can be
redeployed, even if just the war needs redeployment.
So, I am looking for alternative approaches to accomplish the same goal, such as using a
front-end war external to the services deployable that uses inter-module injection (as
described
http://docs.jboss.org/cdi/spec/1.0/html/injectionelresolution.html here under
5.1.4 in the CDI spec). However when I try this, I get "unsatisfied
dependencies" errors. I think I'm satisfying the requirements for inter-module
injection (though the 4th part is unclear to me - "the bean class is required to be
accessible to classes in the module, according to the class accessibility requirements of
the module architecture"). I have confirmed that my war (which has a reference in
jboss-deployment-structure.xml to the ear module and to the ejb-jar subdeployment inside
the ear) can do a jndi lookup for an example EJB using
"java:global/my-ear.ear/my-ejb.jar/SomeService", but @Inject can not find the
same bean. I'm confident that a have cdi enabled on both the war and on the ear (plus
I've tried just a simple bean archive jar instead of my full-blown ear).
Any workarounds or alternative approaches would be most welcome.
Thanks all,
#Tom
--------------------------------------------------------------
Reply to this message by going to Community
[
https://community.jboss.org/message/774712#774712]
Start a new discussion in JBoss AS 7 Development at Community
[
https://community.jboss.org/choose-container!input.jspa?contentType=1&...]