-
1. Re: Implicit bean archive
jharting Feb 18, 2015 3:08 AM (in response to emilyj)Hi Emily,
the Javadoc should be updated. The expected behavior is described here: http://docs.jboss.org/weld/javadoc/2.2/weld-spi/org/jboss/weld/bootstrap/api/CDI11Bootstrap.html
This is the relevant part:
For each implicit bean archive the integrator creates an instance of
BeanDeploymentArchiverepresenting this archive. TheBeanDeploymentArchive.getBeanClasses()of the bean archive returns all the types found in the archive which are annotated with a bean defining annotations or are Session bean definitions. Filtering rules (BeansXml.getScanning()) are not required to be applied by the integrator. TheBeanDeploymentArchive.getEjbs()method returns a collection of EJB descriptors for Session beans present in the archive. -
2. Re: Re: Implicit bean archive
emilyj Feb 18, 2015 9:32 AM (in response to jharting)Thank you Jozef! This is much clearer. I have a question on @Inject on a non-bean archive.
If I have a war archive with the bean-discovery-mod="None" specified, am I right to say it can still have @Inject on the EE component classes if the bean it tries to inject is defined in any explicit/implicit archives?
e.g. in a war archive, I have
public class PassivateTestServlet extends HttpServlet {
@Inject BeanA beanA;
...
}
public class BeanB {
@Inject BeanA beanA;
...
}
In the jarA that the above war can access, I have
@ApplicationScoped
public class BeanA {
...
}
If the jarA is an implict/explicit archive, the injection for the PassivateTestServlet should succeed. However, the injection for BeanB should be null as BeanB in the non-bean archive is not a bean. Please confirm whether my understanding is correct or not.
Please confirm.
Thanks
Emily
-
3. Re: Re: Implicit bean archive
jharting Feb 19, 2015 4:07 AM (in response to emilyj)Hi Emily,
this is a corner case not explicitly covered by the specification. I think your approach is reasonable and we do something similar with WildFly.
-
4. Re: Re: Implicit bean archive
emilyj Feb 19, 2015 7:12 AM (in response to jharting)Thanks you Jozef! It will be helpful if CDI 1.2 or CDI 2.0 spec covers this.