ops4j / org.ops4j.pax.cdi

Contexts and Dependency Injection for OSGi
Apache License 2.0
34 stars 26 forks source link

@Singleton beans are ignored when bean-discovery-mode="annotated" [PAXCDI-231] #274

Closed ops4j-issues closed 7 years ago

ops4j-issues commented 7 years ago

Pavel Turkish created PAXCDI-231

CDI beans that are annotated with javax.inject.Singleton are ingored when bean-discovery-mode="annotated". Besides in org.ops4j.pax.cdi.extension.log I don't see that these beans are processed. At the same time Dependent and ApplicationScoped work.

These are bundles which I install and start:

  1. Id State Location
    1 0 32 System Bundle
    2 1 32 file:./../jars/org.osgi.enterprise-5.0.0.jar
    3 2 32 file:./../jars/org.apache.felix.scr-2.0.2.jar
    4 3 32 file:./../jars/org.apache.felix.configadmin-1.8.8.jar
    5 4 32 file:./../jars/pax-logging-api-1.10.0-SNAPSHOT.jar
    6 5 32 file:./../jars/pax-logging-service-1.10.0-SNAPSHOT.jar
    ...
    20 19 4 file:./../jars/javax.annotation-api-1.2.jar
    21 20 4 file:./../jars/asm-all-5.0.4.jar
    22 21 4 file:./../jars/xbean-bundleutils-4.1.jar
    23 22 4 file:./../jars/xbean-finder-4.1.jar
    24 23 4 file:./../jars/javax.interceptor-api-1.2.jar
    25 24 4 file:./../jars/org.apache.servicemix.bundles.javax-inject-1_2.jar
    26 25 4 file:./../jars/javax.el-api-3.0.0.jar
    27 26 4 file:./../jars/cdi-api-1.2.jar
    28 27 4 file:./../jars/jboss-classfilewriter-1.1.2.Final.jar
    29 28 4 file:./../jars/weld-osgi-bundle-2.3.5.Final.jar
    30 29 2 file:./../jars/ops4j-base-lang-1.5.0.jar
    31 30 2 file:./../jars/pax-swissbox-core-1.8.0.jar
    32 31 2 file:./../jars/pax-swissbox-lifecycle-1.8.0.jar
    33 32 2 file:./../jars/pax-swissbox-tracker-1.8.0.jar
    34 33 4 file:./../jars/pax-cdi-api-1.0.0.RC2.jar
    35 34 4 file:./../jars/pax-cdi-spi-1.0.0.RC2.jar
    36 35 32 file:./../jars/pax-cdi-weld-1.0.0.RC2.jar
    37 36 32 file:./../jars/pax-cdi-extender-1.0.0.RC2.jar
    38 37 32 file:./../jars/pax-cdi-extension-1.0.0.RC2.jar
    ...
    This is my beans.xml
<?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">
</beans>

Affects: 1.0.0.RC2 Votes: 0, Watches: 1