Search in sources :

Example 1 with DisabledBeanException

use of io.micronaut.context.exceptions.DisabledBeanException in project micronaut-core by micronaut-projects.

the class AbstractProviderDefinition method build.

@Override
public T build(BeanResolutionContext resolutionContext, BeanContext context, BeanDefinition<T> definition) throws BeanInstantiationException {
    final BeanResolutionContext.Segment<?> segment = resolutionContext.getPath().currentSegment().orElse(null);
    if (segment != null) {
        final InjectionPoint<?> injectionPoint = segment.getInjectionPoint();
        if (injectionPoint instanceof ArgumentCoercible) {
            Argument<?> injectionPointArgument = ((ArgumentCoercible<?>) injectionPoint).asArgument();
            Argument<?> resolveArgument = injectionPointArgument;
            if (resolveArgument.isOptional()) {
                resolveArgument = resolveArgument.getFirstTypeVariable().orElse(Argument.OBJECT_ARGUMENT);
            }
            @SuppressWarnings("unchecked") Argument<Object> argument = (Argument<Object>) resolveArgument.getFirstTypeVariable().orElse(null);
            if (argument != null) {
                Qualifier<Object> qualifier = (Qualifier<Object>) resolutionContext.getCurrentQualifier();
                if (qualifier == null && segment.getDeclaringType().isIterable()) {
                    final Object n = resolutionContext.getAttribute(Named.class.getName());
                    if (n != null) {
                        qualifier = Qualifiers.byName(n.toString());
                    }
                }
                boolean hasBean = context.containsBean(argument, qualifier);
                if (hasBean) {
                    return buildProvider(resolutionContext, context, argument, qualifier, definition.isSingleton());
                } else {
                    if (injectionPointArgument.isOptional()) {
                        return (T) Optional.empty();
                    } else if (injectionPointArgument.isNullable()) {
                        throw new DisabledBeanException("Nullable bean doesn't exist");
                    } else {
                        if (qualifier instanceof AnyQualifier || isAllowEmptyProviders(context)) {
                            return buildProvider(resolutionContext, context, argument, qualifier, definition.isSingleton());
                        } else {
                            throw new NoSuchBeanException(argument, qualifier);
                        }
                    }
                }
            }
        }
    }
    throw new UnsupportedOperationException("Cannot inject provider for Object type");
}
Also used : Named(io.micronaut.core.naming.Named) Argument(io.micronaut.core.type.Argument) NoSuchBeanException(io.micronaut.context.exceptions.NoSuchBeanException) ArgumentCoercible(io.micronaut.core.type.ArgumentCoercible) DisabledBeanException(io.micronaut.context.exceptions.DisabledBeanException) AnyQualifier(io.micronaut.inject.qualifiers.AnyQualifier) Qualifier(io.micronaut.context.Qualifier) AnyQualifier(io.micronaut.inject.qualifiers.AnyQualifier) BeanResolutionContext(io.micronaut.context.BeanResolutionContext)

Example 2 with DisabledBeanException

use of io.micronaut.context.exceptions.DisabledBeanException in project micronaut-core by micronaut-projects.

the class ServiceHttpClientFactory method healthCheckStarter.

/**
 * Creates a {@link ApplicationEventListener} that listens to {@link ServerStartupEvent} for each configured HTTP client
 * in order to register a health check if necessary.
 *
 * @param configuration The configuration
 * @param instanceList  The instance list
 * @return The event listener
 */
@EachBean(ServiceHttpClientConfiguration.class)
@Requires(condition = ServiceHttpClientCondition.class)
ApplicationEventListener<ServerStartupEvent> healthCheckStarter(@Parameter ServiceHttpClientConfiguration configuration, @Parameter StaticServiceInstanceList instanceList) {
    if (configuration.isHealthCheck()) {
        return event -> {
            final List<URI> originalURLs = configuration.getUrls();
            Collection<URI> loadBalancedURIs = instanceList.getLoadBalancedURIs();
            final HttpClient httpClient = clientFactory.get().getClient(configuration.getHttpVersion(), configuration.getServiceId(), configuration.getPath().orElse(null));
            final Duration initialDelay = configuration.getHealthCheckInterval();
            Duration delay = configuration.getHealthCheckInterval();
            taskScheduler.scheduleWithFixedDelay(initialDelay, delay, () -> Flux.fromIterable(originalURLs).flatMap(originalURI -> {
                URI healthCheckURI = originalURI.resolve(configuration.getHealthCheckUri());
                return Flux.from(httpClient.exchange(HttpRequest.GET(healthCheckURI))).onErrorResume(throwable -> {
                    if (throwable instanceof HttpClientResponseException) {
                        HttpClientResponseException responseException = (HttpClientResponseException) throwable;
                        return Flux.just((HttpResponse<ByteBuffer>) responseException.getResponse());
                    }
                    return Flux.just(HttpResponse.serverError());
                }).map(response -> Collections.singletonMap(originalURI, response.getStatus()));
            }).subscribe(uriToStatusMap -> {
                Map.Entry<URI, HttpStatus> entry = uriToStatusMap.entrySet().iterator().next();
                URI uri = entry.getKey();
                HttpStatus status = entry.getValue();
                if (status.getCode() >= 300) {
                    loadBalancedURIs.remove(uri);
                } else if (!loadBalancedURIs.contains(uri)) {
                    loadBalancedURIs.add(uri);
                }
            }));
        };
    }
    throw new DisabledBeanException("HTTP Client Health Check not enabled");
}
Also used : ServerStartupEvent(io.micronaut.runtime.server.event.ServerStartupEvent) Parameter(io.micronaut.context.annotation.Parameter) Collection(java.util.Collection) DisabledBeanException(io.micronaut.context.exceptions.DisabledBeanException) StaticServiceInstanceList(io.micronaut.discovery.StaticServiceInstanceList) Internal(io.micronaut.core.annotation.Internal) Flux(reactor.core.publisher.Flux) List(java.util.List) EachBean(io.micronaut.context.annotation.EachBean) Factory(io.micronaut.context.annotation.Factory) HttpStatus(io.micronaut.http.HttpStatus) BeanProvider(io.micronaut.context.BeanProvider) Duration(java.time.Duration) Map(java.util.Map) Requires(io.micronaut.context.annotation.Requires) ByteBuffer(io.micronaut.core.io.buffer.ByteBuffer) HttpResponse(io.micronaut.http.HttpResponse) HttpClientResponseException(io.micronaut.http.client.exceptions.HttpClientResponseException) TaskScheduler(io.micronaut.scheduling.TaskScheduler) HttpRequest(io.micronaut.http.HttpRequest) URI(java.net.URI) ApplicationEventListener(io.micronaut.context.event.ApplicationEventListener) Collections(java.util.Collections) ConcurrentLinkedQueue(java.util.concurrent.ConcurrentLinkedQueue) HttpClientResponseException(io.micronaut.http.client.exceptions.HttpClientResponseException) HttpStatus(io.micronaut.http.HttpStatus) Collection(java.util.Collection) StaticServiceInstanceList(io.micronaut.discovery.StaticServiceInstanceList) List(java.util.List) Duration(java.time.Duration) URI(java.net.URI) ByteBuffer(io.micronaut.core.io.buffer.ByteBuffer) Map(java.util.Map) DisabledBeanException(io.micronaut.context.exceptions.DisabledBeanException) Requires(io.micronaut.context.annotation.Requires) EachBean(io.micronaut.context.annotation.EachBean)

Example 3 with DisabledBeanException

use of io.micronaut.context.exceptions.DisabledBeanException in project micronaut-core by micronaut-projects.

the class DefaultBeanContext method doCreateBean.

/**
 * Execution the creation of a bean. The returned value can be null if a
 * factory method returned null.
 *
 * @param resolutionContext The {@link BeanResolutionContext}
 * @param beanDefinition    The {@link BeanDefinition}
 * @param qualifier         The {@link Qualifier}
 * @param qualifierBeanType The bean type used in the qualifier
 * @param isSingleton       Whether the bean is a singleton
 * @param argumentValues    Any argument values passed to create the bean
 * @param <T>               The bean generic type
 * @return The created bean
 */
@Nullable
protected <T> T doCreateBean(@NonNull BeanResolutionContext resolutionContext, @NonNull BeanDefinition<T> beanDefinition, @Nullable Qualifier<T> qualifier, @Nullable Argument<T> qualifierBeanType, boolean isSingleton, @Nullable Map<String, Object> argumentValues) {
    if (argumentValues == null) {
        argumentValues = Collections.emptyMap();
    }
    Qualifier<T> declaredQualifier = beanDefinition.getDeclaredQualifier();
    Class<T> beanType = beanDefinition.getBeanType();
    if (isSingleton) {
        BeanRegistration<T> beanRegistration = singletonObjects.get(new BeanKey<>(beanDefinition, declaredQualifier));
        final Class<T> beanClass = qualifierBeanType.getType();
        if (beanRegistration != null) {
            if (qualifier == null || qualifier.reduce(beanClass, Stream.of(beanRegistration.beanDefinition)).findFirst().isPresent()) {
                return beanRegistration.bean;
            }
        } else if (qualifier != null) {
            beanRegistration = singletonObjects.get(new BeanKey<>(beanDefinition, null));
            if (beanRegistration != null && qualifier.reduce(beanClass, Stream.of(beanRegistration.beanDefinition)).findFirst().isPresent()) {
                return beanRegistration.bean;
            }
        }
    }
    T bean;
    if (beanDefinition instanceof BeanFactory) {
        BeanFactory<T> beanFactory = (BeanFactory<T>) beanDefinition;
        try {
            if (beanFactory instanceof ParametrizedBeanFactory) {
                ParametrizedBeanFactory<T> parametrizedBeanFactory = (ParametrizedBeanFactory<T>) beanFactory;
                Argument<?>[] requiredArguments = parametrizedBeanFactory.getRequiredArguments();
                Map<String, Object> convertedValues = new LinkedHashMap<>(argumentValues);
                for (Argument<?> requiredArgument : requiredArguments) {
                    String argumentName = requiredArgument.getName();
                    Object val = argumentValues.get(argumentName);
                    if (val == null && !requiredArgument.isDeclaredNullable()) {
                        throw new BeanInstantiationException(resolutionContext, "Missing bean argument [" + requiredArgument + "] for type: " + beanType.getName() + ". Required arguments: " + ArrayUtils.toString(requiredArguments));
                    }
                    Object convertedValue = null;
                    if (val != null) {
                        if (requiredArgument.getType().isInstance(val)) {
                            convertedValue = val;
                        } else {
                            convertedValue = ConversionService.SHARED.convert(val, requiredArgument).orElseThrow(() -> new BeanInstantiationException(resolutionContext, "Invalid bean argument [" + requiredArgument + "]. Cannot convert object [" + val + "] to required type: " + requiredArgument.getType()));
                        }
                    }
                    convertedValues.put(argumentName, convertedValue);
                }
                bean = parametrizedBeanFactory.build(resolutionContext, this, beanDefinition, convertedValues);
            } else {
                boolean propagateQualifier = beanDefinition.isProxy() && declaredQualifier instanceof Named;
                if (propagateQualifier) {
                    resolutionContext.setAttribute(BeanDefinition.NAMED_ATTRIBUTE, ((Named) declaredQualifier).getName());
                }
                resolutionContext.setCurrentQualifier(declaredQualifier != null ? declaredQualifier : qualifier);
                try {
                    bean = beanFactory.build(resolutionContext, this, beanDefinition);
                } finally {
                    resolutionContext.setCurrentQualifier(null);
                    if (propagateQualifier) {
                        resolutionContext.removeAttribute(BeanDefinition.NAMED_ATTRIBUTE);
                    }
                }
                if (bean == null) {
                    throw new BeanInstantiationException(resolutionContext, "Bean Factory [" + beanFactory + "] returned null");
                } else {
                    if (bean instanceof Qualified) {
                        ((Qualified) bean).$withBeanQualifier(declaredQualifier);
                    }
                }
            }
        } catch (Throwable e) {
            if (e instanceof DependencyInjectionException) {
                throw e;
            }
            if (e instanceof DisabledBeanException) {
                throw e;
            }
            if (e instanceof BeanInstantiationException) {
                throw e;
            } else {
                if (!resolutionContext.getPath().isEmpty()) {
                    throw new BeanInstantiationException(resolutionContext, e);
                } else {
                    throw new BeanInstantiationException(beanDefinition, e);
                }
            }
        }
    } else {
        ConstructorInjectionPoint<T> constructor = beanDefinition.getConstructor();
        Argument<?>[] requiredConstructorArguments = constructor.getArguments();
        if (requiredConstructorArguments.length == 0) {
            bean = constructor.invoke();
        } else {
            Object[] constructorArgs = new Object[requiredConstructorArguments.length];
            for (int i = 0; i < requiredConstructorArguments.length; i++) {
                Class<?> argument = requiredConstructorArguments[i].getType();
                constructorArgs[i] = getBean(resolutionContext, argument);
            }
            bean = constructor.invoke(constructorArgs);
        }
        inject(resolutionContext, null, bean);
    }
    if (bean != null) {
        Qualifier<T> finalQualifier = qualifier != null ? qualifier : declaredQualifier;
        if (!(bean instanceof BeanCreatedEventListener) && CollectionUtils.isNotEmpty(beanCreationEventListeners)) {
            for (Map.Entry<Class, List<BeanCreatedEventListener>> entry : beanCreationEventListeners) {
                if (entry.getKey().isAssignableFrom(beanType)) {
                    BeanKey<T> beanKey = new BeanKey<>(beanDefinition, finalQualifier);
                    for (BeanCreatedEventListener<?> listener : entry.getValue()) {
                        bean = (T) listener.onCreated(new BeanCreatedEvent(this, beanDefinition, beanKey, bean));
                        if (bean == null) {
                            throw new BeanInstantiationException(resolutionContext, "Listener [" + listener + "] returned null from onCreated event");
                        }
                    }
                }
            }
        }
        if (beanDefinition instanceof ValidatedBeanDefinition) {
            bean = ((ValidatedBeanDefinition<T>) beanDefinition).validate(resolutionContext, bean);
        }
        if (LOG_LIFECYCLE.isDebugEnabled()) {
            LOG_LIFECYCLE.debug("Created bean [{}] from definition [{}] with qualifier [{}]", bean, beanDefinition, finalQualifier);
        }
    }
    return bean;
}
Also used : Argument(io.micronaut.core.type.Argument) BeanCreatedEvent(io.micronaut.context.event.BeanCreatedEvent) LinkedHashMap(java.util.LinkedHashMap) ConcurrentLinkedHashMap(io.micronaut.core.util.clhm.ConcurrentLinkedHashMap) DependencyInjectionException(io.micronaut.context.exceptions.DependencyInjectionException) BeanFactory(io.micronaut.inject.BeanFactory) ParametrizedBeanFactory(io.micronaut.inject.ParametrizedBeanFactory) ParametrizedBeanFactory(io.micronaut.inject.ParametrizedBeanFactory) ArrayList(java.util.ArrayList) List(java.util.List) Named(io.micronaut.core.naming.Named) BeanInstantiationException(io.micronaut.context.exceptions.BeanInstantiationException) Qualified(io.micronaut.inject.qualifiers.Qualified) ValidatedBeanDefinition(io.micronaut.inject.ValidatedBeanDefinition) DisabledBeanException(io.micronaut.context.exceptions.DisabledBeanException) FieldInjectionPoint(io.micronaut.inject.FieldInjectionPoint) ConstructorInjectionPoint(io.micronaut.inject.ConstructorInjectionPoint) InjectionPoint(io.micronaut.inject.InjectionPoint) MethodInjectionPoint(io.micronaut.inject.MethodInjectionPoint) BeanCreatedEventListener(io.micronaut.context.event.BeanCreatedEventListener) Map(java.util.Map) LinkedHashMap(java.util.LinkedHashMap) ConcurrentLinkedHashMap(io.micronaut.core.util.clhm.ConcurrentLinkedHashMap) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) Nullable(io.micronaut.core.annotation.Nullable)

Example 4 with DisabledBeanException

use of io.micronaut.context.exceptions.DisabledBeanException in project micronaut-core by micronaut-projects.

the class DefaultBeanContext method addCandidateToList.

private <T> void addCandidateToList(@Nullable BeanResolutionContext resolutionContext, Argument<T> beanType, BeanDefinition<T> candidate, Collection<BeanRegistration<T>> beansOfTypeList, Qualifier<T> qualifier, boolean singleCandidate) {
    T bean = null;
    final boolean isContainerType = candidate.isContainerType();
    try {
        if (candidate.isSingleton()) {
            synchronized (singletonObjects) {
                try (BeanResolutionContext context = newResolutionContext(candidate, resolutionContext)) {
                    if (candidate instanceof NoInjectionBeanDefinition) {
                        NoInjectionBeanDefinition noibd = (NoInjectionBeanDefinition) candidate;
                        final BeanKey key = new BeanKey(noibd.singletonClass, noibd.qualifier);
                        final BeanRegistration beanRegistration = singletonObjects.get(key);
                        if (beanRegistration != null) {
                            bean = (T) beanRegistration.bean;
                        } else {
                            throw new IllegalStateException("Singleton not present for key: " + key);
                        }
                    } else {
                        bean = doCreateBean(context, candidate, qualifier, beanType, true, null);
                        if (candidate.getBeanType() != beanType.getType() && isContainerType) {
                            registerSingletonBean(candidate, candidate.asArgument(), bean, qualifier, singleCandidate, context.getAndResetDependentBeans());
                        } else {
                            registerSingletonBean(candidate, beanType, bean, qualifier, singleCandidate, context.getAndResetDependentBeans());
                        }
                    }
                }
            }
        } else {
            try (BeanResolutionContext context = newResolutionContext(candidate, resolutionContext)) {
                bean = getScopedBeanForDefinition(context, candidate.asArgument(), qualifier, true, candidate);
            }
        }
    } catch (DisabledBeanException e) {
        if (AbstractBeanContextConditional.LOG.isDebugEnabled()) {
            AbstractBeanContextConditional.LOG.debug("Bean of type [{}] disabled for reason: {}", beanType.getTypeName(), e.getMessage());
        }
    }
    if (bean != null) {
        if (isContainerType && bean instanceof Iterable) {
            Iterable<Object> iterable = (Iterable<Object>) bean;
            int i = 0;
            for (Object o : iterable) {
                if (o == null || !beanType.isInstance(o)) {
                    continue;
                }
                beansOfTypeList.add(new BeanRegistration(new BeanKey(beanType, Qualifiers.byQualifiers(Qualifiers.byName(String.valueOf(i++)), qualifier)), candidate, o));
            }
        } else {
            beansOfTypeList.add(new BeanRegistration(new BeanKey(beanType, candidate.getDeclaredQualifier()), candidate, bean));
        }
    }
}
Also used : DisabledBeanException(io.micronaut.context.exceptions.DisabledBeanException) FieldInjectionPoint(io.micronaut.inject.FieldInjectionPoint) ConstructorInjectionPoint(io.micronaut.inject.ConstructorInjectionPoint) InjectionPoint(io.micronaut.inject.InjectionPoint) MethodInjectionPoint(io.micronaut.inject.MethodInjectionPoint)

Example 5 with DisabledBeanException

use of io.micronaut.context.exceptions.DisabledBeanException in project micronaut-core by micronaut-projects.

the class DefaultBeanContext method initializeContext.

/**
 * Initialize the context with the given {@link io.micronaut.context.annotation.Context} scope beans.
 *
 * @param contextScopeBeans The context scope beans
 * @param processedBeans    The beans that require {@link ExecutableMethodProcessor} handling
 * @param parallelBeans     The parallel bean definitions
 */
protected void initializeContext(@NonNull List<BeanDefinitionReference> contextScopeBeans, @NonNull List<BeanDefinitionReference> processedBeans, @NonNull List<BeanDefinitionReference> parallelBeans) {
    if (CollectionUtils.isNotEmpty(contextScopeBeans)) {
        final Collection<BeanDefinition> contextBeans = new ArrayList<>(contextScopeBeans.size());
        for (BeanDefinitionReference contextScopeBean : contextScopeBeans) {
            try {
                loadContextScopeBean(contextScopeBean, contextBeans::add);
            } catch (Throwable e) {
                throw new BeanInstantiationException("Bean definition [" + contextScopeBean.getName() + "] could not be loaded: " + e.getMessage(), e);
            }
        }
        filterProxiedTypes((Collection) contextBeans, true, false, null);
        filterReplacedBeans(null, (Collection) contextBeans);
        for (BeanDefinition contextScopeDefinition : contextBeans) {
            try {
                loadContextScopeBean(contextScopeDefinition);
            } catch (DisabledBeanException e) {
                if (AbstractBeanContextConditional.LOG.isDebugEnabled()) {
                    AbstractBeanContextConditional.LOG.debug("Bean of type [{}] disabled for reason: {}", contextScopeDefinition.getBeanType().getSimpleName(), e.getMessage());
                }
            } catch (Throwable e) {
                throw new BeanInstantiationException("Bean definition [" + contextScopeDefinition.getName() + "] could not be loaded: " + e.getMessage(), e);
            }
        }
    }
    if (!processedBeans.isEmpty()) {
        @SuppressWarnings("unchecked") Stream<BeanDefinitionMethodReference<?, ?>> methodStream = processedBeans.stream().filter(ref -> ref.isEnabled(this)).map((Function<BeanDefinitionReference, BeanDefinition<?>>) reference -> {
            try {
                return reference.load(this);
            } catch (Exception e) {
                throw new BeanInstantiationException("Bean definition [" + reference.getName() + "] could not be loaded: " + e.getMessage(), e);
            }
        }).filter(bean -> bean.isEnabled(this)).flatMap(beanDefinition -> beanDefinition.getExecutableMethods().parallelStream().filter(method -> method.hasStereotype(Executable.class)).map((Function<ExecutableMethod<?, ?>, BeanDefinitionMethodReference<?, ?>>) executableMethod -> BeanDefinitionMethodReference.of((BeanDefinition) beanDefinition, executableMethod)));
        // group the method references by annotation type such that we have a map of Annotation -> MethodReference
        // ie. Class<Scheduled> -> @Scheduled void someAnnotation()
        Map<Class<? extends Annotation>, List<BeanDefinitionMethodReference<?, ?>>> byAnnotation = new HashMap<>(processedBeans.size());
        methodStream.forEach(reference -> {
            List<Class<? extends Annotation>> annotations = reference.getAnnotationTypesByStereotype(Executable.class);
            annotations.forEach(annotation -> byAnnotation.compute(annotation, (ann, list) -> {
                if (list == null) {
                    list = new ArrayList<>(10);
                }
                list.add(reference);
                return list;
            }));
        });
        // Find ExecutableMethodProcessor for each annotation and process the BeanDefinitionMethodReference
        byAnnotation.forEach((annotationType, methods) -> streamOfType(ExecutableMethodProcessor.class, Qualifiers.byTypeArguments(annotationType)).forEach(processor -> {
            if (processor instanceof LifeCycle<?>) {
                ((LifeCycle<?>) processor).start();
            }
            for (BeanDefinitionMethodReference<?, ?> method : methods) {
                BeanDefinition<?> beanDefinition = method.getBeanDefinition();
                // If declared at the class level it will already have been processed by AnnotationProcessorListener
                if (!beanDefinition.hasStereotype(annotationType)) {
                    // noinspection unchecked
                    if (method.hasDeclaredStereotype(Parallel.class)) {
                        ForkJoinPool.commonPool().execute(() -> {
                            try {
                                processor.process(beanDefinition, method);
                            } catch (Throwable e) {
                                if (LOG.isErrorEnabled()) {
                                    LOG.error("Error processing bean method " + beanDefinition + "." + method + " with processor (" + processor + "): " + e.getMessage(), e);
                                }
                                Boolean shutdownOnError = method.booleanValue(Parallel.class, "shutdownOnError").orElse(true);
                                if (shutdownOnError) {
                                    stop();
                                }
                            }
                        });
                    } else {
                        processor.process(beanDefinition, method);
                    }
                }
            }
            if (processor instanceof LifeCycle<?>) {
                ((LifeCycle<?>) processor).stop();
            }
        }));
    }
    if (CollectionUtils.isNotEmpty(parallelBeans)) {
        processParallelBeans(parallelBeans);
    }
    final Runnable runnable = () -> beanDefinitionsClasses.removeIf((BeanDefinitionReference beanDefinitionReference) -> !beanDefinitionReference.isEnabled(this));
    ForkJoinPool.commonPool().execute(runnable);
}
Also used : OrderUtil(io.micronaut.core.order.OrderUtil) Arrays(java.util.Arrays) BeanDestroyedEventListener(io.micronaut.context.event.BeanDestroyedEventListener) Internal(io.micronaut.core.annotation.Internal) DependencyInjectionException(io.micronaut.context.exceptions.DependencyInjectionException) NonUniqueBeanException(io.micronaut.context.exceptions.NonUniqueBeanException) SoftServiceLoader(io.micronaut.core.io.service.SoftServiceLoader) Future(java.util.concurrent.Future) Map(java.util.Map) DefaultImplementation(io.micronaut.context.annotation.DefaultImplementation) Prototype(io.micronaut.context.annotation.Prototype) CustomScopeRegistry(io.micronaut.context.scope.CustomScopeRegistry) Ordered(io.micronaut.core.order.Ordered) ArgumentUtils(io.micronaut.core.util.ArgumentUtils) TypeConverter(io.micronaut.core.convert.TypeConverter) Singleton(jakarta.inject.Singleton) Set(java.util.Set) ExecutableMethodProcessor(io.micronaut.context.processor.ExecutableMethodProcessor) BeanConfiguration(io.micronaut.inject.BeanConfiguration) FieldInjectionPoint(io.micronaut.inject.FieldInjectionPoint) EventListener(java.util.EventListener) Stream(java.util.stream.Stream) BeanPreDestroyEvent(io.micronaut.context.event.BeanPreDestroyEvent) BeanCreationException(io.micronaut.context.exceptions.BeanCreationException) AnnotationValue(io.micronaut.core.annotation.AnnotationValue) ProxyBeanDefinition(io.micronaut.inject.ProxyBeanDefinition) ApplicationEventListener(io.micronaut.context.event.ApplicationEventListener) BeanFactory(io.micronaut.inject.BeanFactory) Replaces(io.micronaut.context.annotation.Replaces) AnnotationMetadataProvider(io.micronaut.core.annotation.AnnotationMetadataProvider) DisabledBeanException(io.micronaut.context.exceptions.DisabledBeanException) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap) Nullable(io.micronaut.core.annotation.Nullable) ReturnType(io.micronaut.core.type.ReturnType) Argument(io.micronaut.core.type.Argument) ConversionService(io.micronaut.core.convert.ConversionService) Qualified(io.micronaut.inject.qualifiers.Qualified) BeanDestructionException(io.micronaut.context.exceptions.BeanDestructionException) MethodExecutionHandle(io.micronaut.inject.MethodExecutionHandle) NoSuchBeanException(io.micronaut.context.exceptions.NoSuchBeanException) BeanDefinitionMethodReference(io.micronaut.inject.BeanDefinitionMethodReference) ForkJoinPool(java.util.concurrent.ForkJoinPool) Named(io.micronaut.core.naming.Named) PropertyPlaceholderResolver(io.micronaut.context.env.PropertyPlaceholderResolver) BeanDefinition(io.micronaut.inject.BeanDefinition) Parallel(io.micronaut.context.annotation.Parallel) ValidatedBeanDefinition(io.micronaut.inject.ValidatedBeanDefinition) BeanContextException(io.micronaut.context.exceptions.BeanContextException) ListIterator(java.util.ListIterator) ArrayUtils(io.micronaut.core.util.ArrayUtils) LoggerFactory(org.slf4j.LoggerFactory) GenericTypeUtils(io.micronaut.core.reflect.GenericTypeUtils) StreamUtils(io.micronaut.core.util.StreamUtils) ConcurrentLinkedHashMap(io.micronaut.core.util.clhm.ConcurrentLinkedHashMap) PropertyResolver(io.micronaut.core.value.PropertyResolver) CreatedBean(io.micronaut.context.scope.CreatedBean) BeanCreatedEventListener(io.micronaut.context.event.BeanCreatedEventListener) Method(java.lang.reflect.Method) AnyQualifier(io.micronaut.inject.qualifiers.AnyQualifier) Executable(io.micronaut.context.annotation.Executable) ClassUtils(io.micronaut.core.reflect.ClassUtils) ConstructorInjectionPoint(io.micronaut.inject.ConstructorInjectionPoint) Context(io.micronaut.context.annotation.Context) BeanDestroyedEvent(io.micronaut.context.event.BeanDestroyedEvent) Predicate(java.util.function.Predicate) Collection(java.util.Collection) UsedByGeneratedCode(io.micronaut.core.annotation.UsedByGeneratedCode) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Qualifiers(io.micronaut.inject.qualifiers.Qualifiers) BeanIdentifier(io.micronaut.inject.BeanIdentifier) Collectors(java.util.stream.Collectors) Indexes(io.micronaut.core.annotation.Indexes) ResourceLoader(io.micronaut.core.io.ResourceLoader) AnnotationProcessor(io.micronaut.context.processor.AnnotationProcessor) DisposableBeanDefinition(io.micronaut.inject.DisposableBeanDefinition) Objects(java.util.Objects) StringUtils(io.micronaut.core.util.StringUtils) List(java.util.List) AnnotationUtil(io.micronaut.core.annotation.AnnotationUtil) BeanCreatedEvent(io.micronaut.context.event.BeanCreatedEvent) Annotation(java.lang.annotation.Annotation) Optional(java.util.Optional) BeanDefinitionReference(io.micronaut.inject.BeanDefinitionReference) InjectionPoint(io.micronaut.inject.InjectionPoint) ConcurrentLinkedQueue(java.util.concurrent.ConcurrentLinkedQueue) BeanPreDestroyEventListener(io.micronaut.context.event.BeanPreDestroyEventListener) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) HashMap(java.util.HashMap) BeanInitializedEventListener(io.micronaut.context.event.BeanInitializedEventListener) Function(java.util.function.Function) ExecutableMethod(io.micronaut.inject.ExecutableMethod) BeanCreationContext(io.micronaut.context.scope.BeanCreationContext) BeanInstantiationException(io.micronaut.context.exceptions.BeanInstantiationException) HashSet(java.util.HashSet) Primary(io.micronaut.context.annotation.Primary) CustomScope(io.micronaut.context.scope.CustomScope) InitializingBeanDefinition(io.micronaut.inject.InitializingBeanDefinition) ConfigurationReader(io.micronaut.context.annotation.ConfigurationReader) Secondary(io.micronaut.context.annotation.Secondary) MutableConvertibleValues(io.micronaut.core.convert.value.MutableConvertibleValues) Infrastructure(io.micronaut.context.annotation.Infrastructure) Logger(org.slf4j.Logger) Iterator(java.util.Iterator) ApplicationEventPublisher(io.micronaut.context.event.ApplicationEventPublisher) AnnotationMetadataResolver(io.micronaut.core.annotation.AnnotationMetadataResolver) BeanDefinitionValidator(io.micronaut.inject.validation.BeanDefinitionValidator) AdvisedBeanType(io.micronaut.inject.AdvisedBeanType) ShutdownEvent(io.micronaut.context.event.ShutdownEvent) ValueResolver(io.micronaut.core.value.ValueResolver) BeanType(io.micronaut.inject.BeanType) Consumer(java.util.function.Consumer) NonNull(io.micronaut.core.annotation.NonNull) ClassPathResourceLoader(io.micronaut.core.io.scan.ClassPathResourceLoader) StartupEvent(io.micronaut.context.event.StartupEvent) MethodInjectionPoint(io.micronaut.inject.MethodInjectionPoint) ParametrizedBeanFactory(io.micronaut.inject.ParametrizedBeanFactory) Provider(jakarta.inject.Provider) CollectionUtils(io.micronaut.core.util.CollectionUtils) AnnotationMetadata(io.micronaut.core.annotation.AnnotationMetadata) TypeConverterRegistrar(io.micronaut.core.convert.TypeConverterRegistrar) Comparator(java.util.Comparator) Collections(java.util.Collections) Order(io.micronaut.core.annotation.Order) BeanDefinitionMethodReference(io.micronaut.inject.BeanDefinitionMethodReference) LinkedHashMap(java.util.LinkedHashMap) ConcurrentLinkedHashMap(io.micronaut.core.util.clhm.ConcurrentLinkedHashMap) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Parallel(io.micronaut.context.annotation.Parallel) ProxyBeanDefinition(io.micronaut.inject.ProxyBeanDefinition) BeanDefinition(io.micronaut.inject.BeanDefinition) ValidatedBeanDefinition(io.micronaut.inject.ValidatedBeanDefinition) DisposableBeanDefinition(io.micronaut.inject.DisposableBeanDefinition) InitializingBeanDefinition(io.micronaut.inject.InitializingBeanDefinition) Function(java.util.function.Function) BeanDefinitionReference(io.micronaut.inject.BeanDefinitionReference) ArrayList(java.util.ArrayList) List(java.util.List) Executable(io.micronaut.context.annotation.Executable) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) BeanInstantiationException(io.micronaut.context.exceptions.BeanInstantiationException) DisabledBeanException(io.micronaut.context.exceptions.DisabledBeanException) DependencyInjectionException(io.micronaut.context.exceptions.DependencyInjectionException) NonUniqueBeanException(io.micronaut.context.exceptions.NonUniqueBeanException) BeanCreationException(io.micronaut.context.exceptions.BeanCreationException) DisabledBeanException(io.micronaut.context.exceptions.DisabledBeanException) BeanDestructionException(io.micronaut.context.exceptions.BeanDestructionException) NoSuchBeanException(io.micronaut.context.exceptions.NoSuchBeanException) BeanContextException(io.micronaut.context.exceptions.BeanContextException) BeanInstantiationException(io.micronaut.context.exceptions.BeanInstantiationException) Annotation(java.lang.annotation.Annotation)

Aggregations

DisabledBeanException (io.micronaut.context.exceptions.DisabledBeanException)5 Named (io.micronaut.core.naming.Named)3 Argument (io.micronaut.core.type.Argument)3 ConstructorInjectionPoint (io.micronaut.inject.ConstructorInjectionPoint)3 FieldInjectionPoint (io.micronaut.inject.FieldInjectionPoint)3 InjectionPoint (io.micronaut.inject.InjectionPoint)3 MethodInjectionPoint (io.micronaut.inject.MethodInjectionPoint)3 List (java.util.List)3 Map (java.util.Map)3 ApplicationEventListener (io.micronaut.context.event.ApplicationEventListener)2 BeanCreatedEvent (io.micronaut.context.event.BeanCreatedEvent)2 BeanCreatedEventListener (io.micronaut.context.event.BeanCreatedEventListener)2 BeanInstantiationException (io.micronaut.context.exceptions.BeanInstantiationException)2 DependencyInjectionException (io.micronaut.context.exceptions.DependencyInjectionException)2 Nullable (io.micronaut.core.annotation.Nullable)2 ConcurrentLinkedHashMap (io.micronaut.core.util.clhm.ConcurrentLinkedHashMap)2 BeanFactory (io.micronaut.inject.BeanFactory)2 ParametrizedBeanFactory (io.micronaut.inject.ParametrizedBeanFactory)2 ValidatedBeanDefinition (io.micronaut.inject.ValidatedBeanDefinition)2 Qualified (io.micronaut.inject.qualifiers.Qualified)2