-
1. Re: using @Produces and @Inject across AS7 module dependencies
abhi0123 Apr 13, 2015 2:39 AM (in response to ralf.sigmund)I know this is 3 years later but I've the exact same issue. Did you ever find a way to do this?
-
2. Re: using @Produces and @Inject across AS7 module dependencies
mkouba Apr 13, 2015 3:38 AM (in response to abhi0123)abhi0123 Your issue is not the same because your application does not involve multiple Java EE modules (there's only single WAR with one lib in WEB-INF/lib).
-
3. Re: using @Produces and @Inject across AS7 module dependencies
mkouba Apr 13, 2015 4:02 AM (in response to ralf.sigmund)Is there any description on the relation between CDI and the JBoss Modules System?
ralf.sigmund The contract is not clearly defined (CDI spec only specifies intra-applicaion injection). However, from WildFly 8 onwards, it's possible to add a dependency on the external deployment and have classes inside this deployment picked up as CDI beans - see also https://docs.jboss.org/author/display/WFLY8/CDI+Reference#CDIReference-UsingCDIBeansfromoutsidethedeployment. Moreover, there are other ways to implement inter-application injection - see for example this WildFly quickstart: quickstart/inter-app at master · wildfly/quickstart · GitHub.
-
4. Re: using @Produces and @Inject across AS7 module dependencies
jharting Apr 14, 2015 2:13 AM (in response to ralf.sigmund)Note that the built-in modules are not CDI applications on their own. Instead, when a CDI application references these modules, they are treated as bean archives of the application. As for visibility, on WildFly 8 an better the visibility is determined by the (JBoss Modules) classloader visibility. That means that a bean in module A can see a producer in module B as long as the producer is accessible from A's classloader. Therefore, you only need to set up accessibility once - in the module.xml file.
In addition to this, each referenced CDI-enabled built-in module can access beans from the top-level module of a deployment.