code: public static <T> T registerBeanIntoApplicationContext(final ConfigurableApplicationContext applicationContext,
                                                             final T beanInstance, final String beanId) {
          val beanFactory = applicationContext.getBeanFactory();
          if (beanFactory.containsBean(beanId)) {
              return (T) applicationContext.getBean(beanId, beanInstance.getClass());
          }
          beanFactory.initializeBean(beanInstance, beanId);
          beanFactory.autowireBean(beanInstance);
          beanFactory.registerSingleton(beanId, beanInstance);
          return beanInstance;
      }
docs: Register bean into application context t.
  
  @param <T>                the type parameter
  @param applicationContext the application context
  @param beanInstance       the bean instance
  @param beanId             the bean id
  @return the t