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

Александр Свиридов ooo_saturn7 at mail.ru
Wed May 27 02:55:18 EDT 2015


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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/weld-dev/attachments/20150527/f6500a6b/attachment.html 


More information about the weld-dev mailing list