  public void configure(final IOCProcessingContext context, final InjectorFactory injectorFactory,
                        final IOCProcessorFactory procFactory) {
    context.addSingletonScopeAnnotation(ApplicationScoped.class);
    procFactory.registerHandler(Produces.class, new JSR330AnnotationHandler<Produces>() {
      @Override
      public Set<SortUnit> checkDependencies(DependencyControl control, final InjectableInstance instance, Produces annotation,
                                             final IOCProcessingContext context) {
        switch (instance.getTaskType()) {
          case Type:
            break;
          case PrivateField:
          case PrivateMethod:
            instance.ensureMemberExposed(PrivateAccessType.Write);
        }
        injectorFactory.addInjector(new Injector() {
          {
            super.qualifyingMetadata = JSR299QualifyingMetadata.createFromAnnotations(instance.getQualifiers());
            this.provider = true;
            this.enclosingType = instance.getEnclosingType();
            if (injectorFactory.getInjectionContext().isInjectorRegistered(enclosingType, qualifyingMetadata)) {
              setInjected(true);
            }
            else {
              context.registerTypeDiscoveryListener(new TypeDiscoveryListener() {
                @Override
                public void onDiscovery(IOCProcessingContext context, InjectionPoint injectionPoint) {
                  if (injectionPoint.getEnclosingType().equals(enclosingType)) {
                    setInjected(true);
                  }
                }
              });
            }
          }
          @Override
          public Statement instantiateOnly(InjectionContext injectContext, InjectableInstance injectableInstance) {
            return instance.getValueStatement();
          }
          @Override
          public Statement getType(InjectionContext injectContext, InjectableInstance injectableInstance) {
            return instance.getValueStatement();
          }
          @Override
          public boolean isSingleton() {
            return false;
          }
          @Override
          public boolean isPseudo() {
            return false;
          }
          @Override
          public String getVarName() {
            return null;
          }
          @Override
          public MetaClass getInjectedType() {
            switch (instance.getTaskType()) {
              case StaticMethod:
              case PrivateMethod:
              case Method:
                return instance.getMethod().getReturnType();
              case PrivateField:
              case Field:
                return instance.getField().getType();
              default:
                return null;
            }
          }
        });
        control.masqueradeAs(instance.getElementTypeOrMethodReturnType());
        return Collections.singleton(new SortUnit(instance.getEnclosingType(), true));
      }
      @Override
      public boolean handle(final InjectableInstance instance, final Produces annotation,
                            final IOCProcessingContext context) {
        return true;
      }
    }, Rule.before(EntryPoint.class, ApplicationScoped.class, Singleton.class));
    procFactory.registerHandler(ApplicationScoped.class, new JSR330AnnotationHandler<ApplicationScoped>() {
      public boolean handle(InjectableInstance instance, ApplicationScoped annotation, IOCProcessingContext context) {
        InjectionContext injectionContext = injectorFactory.getInjectionContext();
        TypeInjector i = (TypeInjector) instance.getInjector();
        i.setSingleton(true);
        i.getType(injectionContext, null);
        return true;
      }
    });
    procFactory.registerHandler(Dependent.class, new JSR330AnnotationHandler<Dependent>() {
      public boolean handle(InjectableInstance instance, Dependent annotation, IOCProcessingContext context) {
        InjectionContext injectionContext = injectorFactory.getInjectionContext();
        TypeInjector i = (TypeInjector) instance.getInjector();
        i.getType(injectionContext, null);
        return true;
      }
    });
    if (context.getGeneratorContext() != null && context.getGeneratorContext().getTypeOracle() != null) {
      for (JPackage pkg : context.getGeneratorContext().getTypeOracle().getPackages()) {
        TypeScan:
        for (JClassType type : pkg.getTypes()) {
          if (type.isAbstract() || type.isInterface() != null
                  || type.getQualifiedSourceName().startsWith("java.")) continue;
          if (!type.isDefaultInstantiable()) {
            boolean hasInjectableConstructor = false;
            for (JConstructor c : type.getConstructors()) {
              if (c.isAnnotationPresent(Inject.class)) {
                hasInjectableConstructor = true;
                break;
              }
            }
            if (!hasInjectableConstructor) {
              continue;
            }
          }
          for (Annotation a : type.getAnnotations()) {
            Class<? extends Annotation> annoClass = a.annotationType();
            if (annoClass.isAnnotationPresent(Scope.class)
                    || annoClass.isAnnotationPresent(NormalScope.class)) {
              continue TypeScan;
            }
          }
          MetaClass metaClass = GWTClass.newInstance(type.getOracle(), type);
          if (injectorFactory.hasType(metaClass)) {
            continue;
          }
          injectorFactory.addPsuedoScopeForType(metaClass);
        }
      }
    }
  }

  public void configure(final IOCProcessingContext context, final InjectorFactory injectorFactory,
                        final IOCProcessorFactory procFactory) {
    context.addSingletonScopeAnnotation(ApplicationScoped.class);
    procFactory.registerHandler(Produces.class, new JSR330AnnotationHandler<Produces>() {
      @Override
      public Set<SortUnit> checkDependencies(DependencyControl control, final InjectableInstance instance, Produces annotation,
                                             final IOCProcessingContext context) {
        switch (instance.getTaskType()) {
          case Type:
            break;
          case PrivateField:
          case PrivateMethod:
            instance.ensureMemberExposed(PrivateAccessType.Read);
        }
        injectorFactory.addInjector(new Injector() {
          {
            super.qualifyingMetadata = JSR299QualifyingMetadata.createFromAnnotations(instance.getQualifiers());
            this.provider = true;
            this.enclosingType = instance.getEnclosingType();
            if (injectorFactory.getInjectionContext().isInjectorRegistered(enclosingType, qualifyingMetadata)) {
              setInjected(true);
            }
            else {
              context.registerTypeDiscoveryListener(new TypeDiscoveryListener() {
                @Override
                public void onDiscovery(IOCProcessingContext context, InjectionPoint injectionPoint) {
                  if (injectionPoint.getEnclosingType().equals(enclosingType)) {
                    setInjected(true);
                  }
                }
              });
            }
          }
          @Override
          public Statement instantiateOnly(InjectionContext injectContext, InjectableInstance injectableInstance) {
            return instance.getValueStatement();
          }
          @Override
          public Statement getType(InjectionContext injectContext, InjectableInstance injectableInstance) {
            return instance.getValueStatement();
          }
          @Override
          public boolean isSingleton() {
            return false;
          }
          @Override
          public boolean isPseudo() {
            return false;
          }
          @Override
          public String getVarName() {
            return null;
          }
          @Override
          public MetaClass getInjectedType() {
            switch (instance.getTaskType()) {
              case StaticMethod:
              case PrivateMethod:
              case Method:
                return instance.getMethod().getReturnType();
              case PrivateField:
              case Field:
                return instance.getField().getType();
              default:
                return null;
            }
          }
        });
        control.masqueradeAs(instance.getElementTypeOrMethodReturnType());
        return Collections.singleton(new SortUnit(instance.getEnclosingType(), true));
      }
      @Override
      public boolean handle(final InjectableInstance instance, final Produces annotation,
                            final IOCProcessingContext context) {
        return true;
      }
    }, Rule.before(EntryPoint.class, ApplicationScoped.class, Singleton.class));
    procFactory.registerHandler(ApplicationScoped.class, new JSR330AnnotationHandler<ApplicationScoped>() {
      public boolean handle(InjectableInstance instance, ApplicationScoped annotation, IOCProcessingContext context) {
        InjectionContext injectionContext = injectorFactory.getInjectionContext();
        TypeInjector i = (TypeInjector) instance.getInjector();
        i.setSingleton(true);
        i.getType(injectionContext, null);
        return true;
      }
    });
    procFactory.registerHandler(Dependent.class, new JSR330AnnotationHandler<Dependent>() {
      public boolean handle(InjectableInstance instance, Dependent annotation, IOCProcessingContext context) {
        InjectionContext injectionContext = injectorFactory.getInjectionContext();
        TypeInjector i = (TypeInjector) instance.getInjector();
        i.getType(injectionContext, null);
        return true;
      }
    });
    if (context.getGeneratorContext() != null && context.getGeneratorContext().getTypeOracle() != null) {
      for (JPackage pkg : context.getGeneratorContext().getTypeOracle().getPackages()) {
        TypeScan:
        for (JClassType type : pkg.getTypes()) {
          if (type.isAbstract() || type.isInterface() != null
                  || type.getQualifiedSourceName().startsWith("java.")) continue;
          if (!type.isDefaultInstantiable()) {
            boolean hasInjectableConstructor = false;
            for (JConstructor c : type.getConstructors()) {
              if (c.isAnnotationPresent(Inject.class)) {
                hasInjectableConstructor = true;
                break;
              }
            }
            if (!hasInjectableConstructor) {
              continue;
            }
          }
          for (Annotation a : type.getAnnotations()) {
            Class<? extends Annotation> annoClass = a.annotationType();
            if (annoClass.isAnnotationPresent(Scope.class)
                    || annoClass.isAnnotationPresent(NormalScope.class)) {
              continue TypeScan;
            }
          }
          MetaClass metaClass = GWTClass.newInstance(type.getOracle(), type);
          if (injectorFactory.hasType(metaClass)) {
            continue;
          }
          injectorFactory.addPsuedoScopeForType(metaClass);
        }
      }
    }
  }
