code: public void addListener(EnvLoaderListener listener)
    {
      super.addListener(listener);
      synchronized (_listeners) {
        for (int i = _listeners.size() - 1; i >= 0; i--) {
          EnvLoaderListener oldListener = _listeners.get(i);
  
          if (listener == oldListener) {
            return;
          }
          else if (oldListener == null)
            _listeners.remove(i);
        }
  
        _listeners.add(listener);
      }
  
      if (getLifecycle().isStarting()) {
        listener.environmentBind(this);
      }
  
      if (getLifecycle().isStarting() && _isConfigComplete) {
        listener.environmentStart(this);
      }
    }
docs: Adds a listener to detect environment lifecycle changes.