public static Set<Class<? extends Annotation>> getInjectAnnotations() {
    if (injectAnnotationClassesAsStrings == null) {
      injectAnnotationClassesAsStrings = new HashSet<String>();
      injectAnnotationClassesAsStrings.add("javax.inject.Inject");
      injectAnnotationClassesAsStrings.add("javax.annotation.Resource");
      injectAnnotationClassesAsStrings.add("org.springframework.beans.factory.annotation.Required");
      injectAnnotationClassesAsStrings.add("org.springframework.beans.factory.annotation.Autowired");
      injectAnnotationClassesAsStrings.add("com.google.inject.Inject");
    }

    Set<Class<? extends Annotation>> classesToInject = new HashSet<Class<? extends Annotation>>();
    for (String injectAnnotationAsString : injectAnnotationClassesAsStrings) {
      try {
        Class<?> injectAnnotationClass = Class.forName(injectAnnotationAsString);
        classesToInject.add((Class<? extends Annotation>) injectAnnotationClass);
      }
      catch (ClassNotFoundException ignore) {
        // not in classpath, is OK
      }
      catch (ClassCastException cce) {
        throw new RuntimeException("configured class " + injectAnnotationAsString + " is no annotation.", cce);
      }
    }
    return classesToInject;
  }