@Override
  public ContextCustomizer createContextCustomizer(Class<?> testClass,
                                                   List<ContextConfigurationAttributes> configAttributes) {
    // We gather the explicit mock definitions here since they form part of the
    // MergedContextConfiguration key. Different mocks need to have a different key.
    DefinitionsParser parser = new DefinitionsParser();
    parser.parse(testClass);
    return new SpockContextCustomizer(parser.getDefinitions());
  }
A {@link ContextCustomizerFactory} to add Mockito support.

original author Phillip Webb
spock-spring/src/main/java/org/spockframework/spring/mock/SpockContextCustomizerFactory.java