Search code examples
javajbosscdijboss-arquillian

Unsatisfied dependencies for type [***<T>] with qualifiers [@Default] at injection point [[field] @Inject


When deploying to a jboss arquilian server, I've the following issue (that I don't seem to have when I deploy my local jboss server

org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [CarPolicyServiceWithContext] with qualifiers [@Default] at injection point [[field] @Inject com.athlon.thrift.web.utils.MSFOTContextUtils.carPolicyService]

Injection

@ApplicationScoped
public class MSFOTContextUtils {

    @Inject
    Logger logger;

    @Inject
    CarPolicyServiceWithContext carPolicyService;

Provider

@ApplicationScoped
public class ServiceProvider {

    @Inject
    @Any
    private Instance<CarPolicyServiceWithContext> carPolicyServices;



    private static final String COUNTRY = "NL";
    private static final Logger LOGGER = LoggerFactory.getLogger(ServiceProvider.class);

     @Produces
    public CarPolicyServiceWithContext getCarPolicyService() {
        Instance<CarPolicyServiceWithContext> found = carPolicyServices.select(
                new CountryQualifier(COUNTRY));
        LOGGER.info("CarPolicyServiceWithContext loaded"+found.toString());
        return found.get();
    }

    public static class CountryQualifier
            extends AnnotationLiteral<Country>
            implements Country {
        private String value;

        public CountryQualifier(String value) {
            this.value = value;
        }

        public String value() {
            return value;
        }
    }
}

Bean

@Country("NL")
@ApplicationScoped
public class CarPolicyNetherlandsService implements CarPolicyServiceWithContext<MSFOTContext> {

I added some logging in the provider, but I don't see it printed in the arquillian jboss logs...

Thanks !


Solution

  • in the @Deployment archive, for some reason, the ServiceProvider class above was not added in the archive.