繁体   English   中英

对类型[***的依赖性不满意 <T> ]在注入点[[field] @Inject处带有限定符[@Default]

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

部署到jboss Arquilian服务器时,出现以下问题(部署本地jboss服务器时似乎没有

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

注射

@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日志中打印...

谢谢 !

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM