private static BeanDefinition getOrAddBeanDefinition(BeanDefinitionRegistry registry,
                                                       Class<? extends SpockMockPostprocessor> postProcessor) {
    if (!registry.containsBeanDefinition(BEAN_NAME)) {
      RootBeanDefinition definition = new RootBeanDefinition(postProcessor);
      definition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
      ConstructorArgumentValues constructorArguments = definition.getConstructorArgumentValues();
      constructorArguments.addIndexedArgumentValue(0, new LinkedHashSet<SpockDefinition>());
      registry.registerBeanDefinition(BEAN_NAME, definition);
      return definition;
    }
    return registry.getBeanDefinition(BEAN_NAME);
  }
Register the processor with a {@link BeanDefinitionRegistry}. Not required when
using the Spocks {@link spock.lang.Specification} as registration is automatic.

@param registry the bean definition registry
@param postProcessor the post processor class to register
@param definitions the initial mock/spy definitions
spock-spring/src/main/java/org/spockframework/spring/mock/SpockMockPostprocessor.java