private void injectServices(Object target, boolean sharedFields) throws IllegalAccessException {
    for (final FieldInfo field : spec.getAllFields()) {
      Field rawField = field.getReflection();
      if ((rawField.isAnnotationPresent(Inject.class)
          || ReflectionUtil.isAnnotationPresent(rawField, "javax.inject.Inject")
          || rawField.isAnnotationPresent(Autobuild.class))
          && rawField.isAnnotationPresent(Shared.class) == sharedFields) {
        Object value = registry.getObject(rawField.getType(), createAnnotationProvider(field));
        rawField.setAccessible(true);
        rawField.set(target, value);
      } else if (rawField.isAnnotationPresent(InjectService.class)) {
        String serviceName = rawField.getAnnotation(InjectService.class).value();
        Object value = registry.getService(serviceName, rawField.getType());
        rawField.setAccessible(true);
        rawField.set(target, value);
      }
    }
  }
Controls creation, startup and shutdown of the Tapestry container,
and injects specifications with Tapestry-provided objects.

@author Peter Niederwieser
spock-tapestry/src/main/java/org/spockframework/tapestry/TapestryInterceptor.java