private static void injectSpies(SpringTestContext testContext) {
    ApplicationContext applicationContext = testContext.getApplicationContext();
    if (applicationContext.containsBean(SpockMockPostprocessor.class.getName())) {
      SpockMockPostprocessor mockPostprocessor = applicationContext.getBean(SpockMockPostprocessor.class);
      mockPostprocessor.injectSpies(testContext.getTestInstance());
    }
  }
This {@link TestExecutionListener} takes care of attaching and detaching the
mocks to the current {@link Specification}.

@author Leonard Bruenings
spock-spring/src/main/java/org/spockframework/spring/SpringMockTestExecutionListener.java