private boolean isScopedTarget(String beanName) {
    try {
      return ScopedProxyUtils.isScopedTarget(beanName);
    } catch (Throwable ex) {
      return false;
    }
  }
Factory method used by defined beans to actually create the mock.

@param mockDefinition the mock definition
@param name the bean name
@return the mock instance
spock-spring/src/main/java/org/spockframework/spring/mock/SpockMockPostprocessor.java