Class MockSpringFactoriesLoader

java.lang.Object
org.springframework.core.io.support.SpringFactoriesLoader
org.springframework.core.test.io.support.MockSpringFactoriesLoader

public class MockSpringFactoriesLoader extends SpringFactoriesLoader
Simple mock SpringFactoriesLoader implementation that can be used for testing purposes.
Since:
6.0
Author:
Phillip Webb
  • Constructor Details

  • Method Details

    • instantiateFactory

      protected <T> T instantiateFactory(String implementationName, Class<T> type, @Nullable SpringFactoriesLoader.ArgumentResolver argumentResolver, SpringFactoriesLoader.FailureHandler failureHandler)
      Overrides:
      instantiateFactory in class SpringFactoriesLoader
    • add

      @SafeVarargs public final <T> void add(Class<T> factoryType, Class<? extends T>... factoryImplementations)
      Add factory implementations to this instance.
      Parameters:
      factoryType - the factory type class
      factoryImplementations - the implementation classes
    • add

      public void add(String factoryType, String... factoryImplementations)
      Add factory implementations to this instance.
      Parameters:
      factoryType - the factory type class name
      factoryImplementations - the implementation class names
    • addInstance

      public <T> void addInstance(Class<T> factoryType, T... factoryInstances)
      Add factory instances to this instance.
      Parameters:
      factoryType - the factory type class
      factoryInstances - the implementation instances to add
    • addInstance

      public <T> void addInstance(String factoryType, T... factoryInstance)
      Add factory instances to this instance.
      Parameters:
      factoryType - the factory type class name
      factoryInstance - the implementation instances to add