code: public <T> InjectorConfiguration withFactory(
          Class<T> classDefinition,
          Provider<T> factory
      ) {
          if (classDefinition.equals(Injector.class)) {
              throw new DependencyInjectionFailedException("Cowardly refusing to define a global factory for Injector since that would lead to a Service Locator pattern. If you need the injector, please define it on a per-class or per-method basis.");
          }
          //noinspection unchecked
          return new InjectorConfiguration(
              scopes, definedClasses,
              factories.withModified((value) -> value.with(classDefinition, factory)),
              factoryClasses,
              sharedClasses,
              sharedInstances,
              aliases,
              collectedAliases,
              namedParameterValues
          );
      }
docs: Specify that the given class should be created using the factory instance specified.
  
  @param classDefinition the class that should be produced using a factory.
  @param factory the factory class that creates the class definition
  @param <T> type of the class
  
  @return a modified copy of this injection configuration.