Java 类javax.enterprise.inject.AmbiguousResolutionException 实例源码

项目:trimou    文件:CDIBeanResolver.java   
@Override
public void init() {
    if (beanManager == null) {
        throw new IllegalStateException("BeanManager not set - invalid resolver configuration");
    }
    // Init cache max size
    long beanCacheMaxSize = configuration.getLongPropertyValue(BEAN_CACHE_MAX_SIZE_KEY);
    beanCache = configuration.getComputingCacheFactory().create(COMPUTING_CACHE_CONSUMER_ID, key -> {
        Set<Bean<?>> beans = beanManager.getBeans(key);
        // Check required for CDI 1.0
        if (beans == null || beans.isEmpty()) {
            return Optional.empty();
        }
        try {
            return Optional.of(beanManager.resolve(beans));
        } catch (AmbiguousResolutionException e) {
            LOGGER.warn("An ambiguous EL name exists [name: {}]", key);
            return Optional.empty();
        }
    }, null, beanCacheMaxSize, null);
    LOGGER.debug("Initialized [beanCacheMaxSize: {}]", beanCacheMaxSize);
}
项目:lightblue-client    文件:StubInstance.java   
@Override
public T get() {
    if (isAmbiguous()) {
        throw new AmbiguousResolutionException();
    }

    if (isUnsatisfied()) {
        throw new UnsatisfiedResolutionException();
    }

    return instance;
}