当前位置: 首页 > 知识库问答 >
问题:

在注入点[[field]@inject处具有限定符[@default]的类型[***]的依赖项不满足

须捷
2023-03-14

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

org.jboss.weld.exceptions.DeploymentException:WELD-001408类型[CarPolicyServiceWithContext]的依赖项不满足,其限定符为[@default],位于注入点[[field]@Inject com.athlon.thrift.web.utils.MSFotContextutils.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个答案

司空俊雄
2023-03-14

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

 类似资料: