/**
   * Finish the refresh of this context, invoking the LifecycleProcessor's onRefresh() method and
   * publishing the {@link org.springframework.context.event.ContextRefreshedEvent}.
   */
  protected void finishRefresh() {
    // Initialize lifecycle processor for this context.
    initLifecycleProcessor();

    // Propagate refresh to lifecycle processor first.
    getLifecycleProcessor().onRefresh();

    // Publish the final event.
    publishEvent(new ContextRefreshedEvent(this));

    // Participate in LiveBeansView MBean, if active.
    LiveBeansView.registerApplicationContext(this);
  }