code: public static <T> Map<String, T> getBeansOfType(ApplicationContext appContext, Class<T> clazz) {
          try {
              return appContext.getBeansOfType(clazz);
          } catch (BeansException e) {
              return new HashMap<String, T>();
          }
      }
docs: Gets all beans of a given type.
  
  @param appContext
  @param clazz
  @return a Map with the matching beans, containing the bean names as keys
  and the corresponding bean instances as values