code: public void destroy() {
          for (Entry<String, Runnable> entry : destructionCallbacks.entrySet()) {
              try {
                  entry.getValue().run();
              } catch (Throwable t) {
                  log.error("Error during destruction callback for bean " + entry.getKey(), t);
              }
          }
          
          beans.clear();
          destructionCallbacks.clear();
      }
docs: Calls all registered destruction callbacks and removes all bean references from the
  container.