类型[*** <t>]的不满意依赖关系,在注入点[[field] @Inject使用限定符[@Default]

时间:2017-07-27 09:12:35

标签: java jboss cdi jboss-arquillian

在部署到jboss arquilian服务器时,我遇到了以下问题(我在部署本地jboss服务器时似乎没有这个问题

  

org.jboss.weld.exceptions.DeploymentException:WELD-001408类型[CarPolicyServiceWithContext]的不满意依赖关系,在注入点[[field] @Inject com.athlon.thrift.web.utils.MSFOTContextUtils中使用限定符[@Default]。 carPolicyService]

注射

@ApplicationScoped
public class MSFOTContextUtils {

    @Inject
    Logger logger;

    @Inject
    CarPolicyServiceWithContext carPolicyService;

提供商

@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;
        }
    }
}

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

我在提供商中添加了一些日志记录,但我没有在arquillian jboss日志中看到它...

谢谢!

1 个答案:

答案 0 :(得分:0)

@peployment存档中的

由于某种原因,上面的ServiceProvider类未添加到存档中。