Hello,

    I'm confused about a CDI error, I would expect this to work... What am I doing wrong? It's true otherwise that the interface is defined in another JAR than the producer but I wouldn't expect it to be a problem...

    At runtime I get:

08-Mar-2018 12:27:57.287 SEVERE [localhost-startStop-1] org.apache.openejb.cdi.OpenEJBLifecycle.startApplication CDI Beans module deployment failed  org.apache.webbeans.exception.WebBeansDeploymentException: javax.enterprise.inject.UnsatisfiedResolutionException: Api type [com.lecip.core.application.customer_profiles.CustomerProfile] is not found with the qualifiers Qualifiers: [@com.lecip.core.application.customer_profiles.CustomerContext()] for injection into Field Injection Point, field name : _customerProfile, Bean Owner : [TmsAllFunctionalitiesProvider, WebBeansType:MANAGED, Name:null, API Types:[java.lang.Object,com.lecip.tms.tms_core.authorization.TmsAllFunctionalitiesProvider,com.lecip.core.authorization.AllFunctionalitiesProvider], Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]]

    Any ideas?

--- 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_2.xsd";
       version="1.2" bean-discovery-mode="all">
</beans>

-- CustomerContext.java --

@Qualifier
@Retention(RUNTIME)
@Target({TYPE, METHOD, FIELD, PARAMETER})
public @interface CustomerContext {}

-- CustomerProfileProducer.java --

public class CustomerProfileProducer {
    @Produces
    @CustomerContext
     public CustomerProfile getCustomerProfile() {
         return null;
   }
}

 -- Injecting class --

    @Inject @CustomerContext
    CustomerProfile customerProfile;

Reply via email to