[weld-dev] CDI: bean-discovery-mode=annotated is ignored

Jozef Hartinger jharting at redhat.com
Wed May 27 04:21:06 EDT 2015


It seems that Pax CDI only implements explicit bean archives so far. I 
filed an issue at https://ops4j1.jira.com/browse/PAXCDI-186 You'll need 
to mark classes/packages you do not want discovered with @Vetoed or use 
an exclude filter 
http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#exclude_filters

On 05/27/2015 08:55 AM, Александр Свиридов wrote:
>
> I use weld as CDI container. Besides I use osgi (felix). So it's 
> javase + felix+weld+pax. I have the following beans.xml
>
> |<?xml version="1.0"  encoding="UTF-8"?><beans xmlns="http://java.sun.com/xml/ns/javaee"
>         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd"
>         bean-discovery-mode="annotated"></beans>|
>
> And I have two classes:
>
> |@ApplicationScopedpublicclass  A{@Injectprivate  B b;publicvoid  postCreate(@ObservesContainerInitialized  event,BundleContext  ctx){
>     b.test();}}|
>
> And class B
>
> |publicclass  B{publicvoid  test(){System.out.println("test is here");}}|
>
> As you see class B doesn't have any @scopes or @dependent annotations. 
> However when I start application object of class B is injected to 
> object A and method test is invoked. Why? As I understand it mustn't 
> be injected.
>
> *EDIT 1*
> I tried to use 1.1 version:
>
> |<?xml version="1.0"  encoding="UTF-8"?><beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
>         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
>          http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
>         bean-discovery-mode="annotated"  version="1.1"></beans>|
>
> but it didn't help.
>
>
>
>
> _______________________________________________
> weld-dev mailing list
> weld-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/weld-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/weld-dev/attachments/20150527/7a6e6e5b/attachment-0001.html 


More information about the weld-dev mailing list