code: public static <T> T getBean(String id, Class<T> clazz) {
          ApplicationContext appContext = getAppContext();
          return appContext == null ? null
                  : appContext.containsBean(id) && appContext.isTypeMatch(id, clazz) ? appContext.getBean(id, clazz) : null;
      }
docs: Returns the bean with an id matching the specified id, or null if none found.
  
  @param <T> Class of return type.
  @param id Bean id
  @param clazz Expected return type.
  @return Returns the bean instance whose id matches the specified id, or null if none found or
  if the application context cannot be determined.