@Override
  @SuppressWarnings("unchecked")
  public T getObject() throws Exception {
    if (instance == null) {
      MockNature nature = MockNature.valueOf(mockNature.toUpperCase(Locale.ROOT));
      instance = new DetachedMockFactory().createMock(name, targetClass, nature, emptyMap());
    }
    return instance;
  }
Takes care of instantiating detached spock Mocks.

Spring integration of spock mocks is heavily inspired by
Springokito {@see https://bitbucket.org/kubek2k/springockito}.

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