@SuppressWarnings("unchecked") private void processAnnotations(Object instance, Component<?> definition, IntrospectionContext context) { InjectingComponentType componentType = (InjectingComponentType) definition.getComponentType(); Class<?> implClass = instance.getClass(); // handle consumer annotations AnnotationProcessor consumerProcessor = annotationProcessors.get(org.fabric3.api.annotation.Consumer.class); for (Method method : implClass.getDeclaredMethods()) { org.fabric3.api.annotation.Consumer consumer = method.getAnnotation(org.fabric3.api.annotation.Consumer.class); if (consumer == null) { continue; } TypeMapping mapping = context.getTypeMapping(implClass); if (mapping == null) { mapping = new TypeMapping(); context.addTypeMapping(implClass, mapping); } helper.resolveTypeParameters(implClass, mapping); consumerProcessor.visitMethod(consumer, method, implClass, componentType, context); } // add automatic configuration for consumer annotations for (Consumer<ComponentType> consumer : componentType.getConsumers().values()) { String name = consumer.getName(); Consumer<Component> componentConsumer = new Consumer<>(name); componentConsumer.setSources(Collections.singletonList(URI.create(name))); definition.add(componentConsumer); } }