Automatically registers any container-managed bean with the framework.

@param bean Object to register.
@param beanName Name of the managed bean.
5310
@Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        registerObject(bean);
        return bean;
    }
873961
private void initializeManagedObjectFactoryOrConstructor(BeanMetaData bmd) throws EJBConfigurationException {
        if (bmd.isManagedBean()) {
            bmd.ivEnterpriseBeanFactory = getManagedBeanManagedObjectFactory(bmd, bmd.enterpriseBeanClass);

            // If the managed object factroy and the managed object instances will perform all injection
            // and interceptor processing, then save that indication and reset all of the methodinfos so
            // that AroundInvoke is not handled by the EJB Container. Injection, PostConstruct, and
            // PreDestroy will also be skipped.
            if (bmd.ivEnterpriseBeanFactory != null && bmd.ivEnterpriseBeanFactory.managesInjectionAndInterceptors()) {
                bmd.managedObjectManagesInjectionAndInterceptors = true;
                if (bmd.ivInterceptorMetaData != null && bmd.localMethodInfos != null) {
                    for (EJBMethodInfoImpl mbMethod : bmd.localMethodInfos) {
                        mbMethod.setAroundInterceptorProxies(null);
                    }
                }
            }
        } else {
            bmd.ivEnterpriseBeanFactory = getEJBManagedObjectFactory(bmd, bmd.enterpriseBeanClass);
        }
        if (bmd.ivEnterpriseBeanFactory == null) {
            try {
                bmd.ivEnterpriseBeanClassConstructor = bmd.enterpriseBeanClass.getConstructor((Class<?>[]) null);
            } catch (NoSuchMethodException e) {
                Tr.error(tc, "JIT_NO_DEFAULT_CTOR_CNTR5007E",
                         new Object[] { bmd.enterpriseBeanClassName, bmd.enterpriseBeanName });
                throw new EJBConfigurationException("CNTR5007E: The " + bmd.enterpriseBeanClassName + " bean class for the " + bmd.enterpriseBeanName +
                                                    " bean does not have a public constructor that does not take parameters.");
            }
        }
        // Removed else clause that calls bmd.ivEnterpriseBeanFactory.getConstructor() because this method
        // is called before cdiMMD.setWebBeansContext(webBeansContext) in LibertySingletonServer. If we call
        // getConstructor before setting the webBeansContext, we default to a constructor that may not be correct.
        // eg. returning no-arg constructor when multi-arg constructor injection should be invoked.
    }
318826
void registerMBean(Configuration conf) {
    // We wrap to bypass standard mbean naming convention.
    // This wraping can be removed in java 6 as it is more flexible in
    // package naming for mbeans and their impl.
    StandardMBean bean;
    try {
      versionBeanName = VersionInfo.registerJMX("NameNode");
      myFSMetrics = new FSNamesystemMetrics(conf, this);
      bean = new StandardMBean(this, FSNamesystemMBean.class);
      mbeanName = MBeanUtil.registerMBean("NameNode", "FSNamesystemState", bean);
    } catch (NotCompliantMBeanException e) {
      e.printStackTrace();
    }

    LOG.info("Registered FSNamesystemStatusMBean");
  }
1370908
private BeanDefinitionRegistry getBeanDefinitionRegistry(ApplicationContext context) {
		if (context instanceof BeanDefinitionRegistry) {
			return (BeanDefinitionRegistry) context;
		}
		if (context instanceof AbstractApplicationContext) {
			return (BeanDefinitionRegistry) ((AbstractApplicationContext) context)
					.getBeanFactory();
		}
		throw new IllegalStateException("Could not locate BeanDefinitionRegistry");
	}
16978
public String registerMBean(Object bean, String name)
            throws MalformedObjectNameException, NotCompliantMBeanException, MBeanRegistrationException {
        return registerMBean(bean, name, false);
    }
265104
void addBean(Bean bean) {
		if (bean == null) return;
		this.beans.add(new BeanDefinition(bean.name(), bean.clazz()));
	}
848435
public void registerComponents() throws Exception {
		Debug.logVerbose("[JdonFramework] note: registe all basic components in container.xml size=" + basicComponents.size(), module);
		try {
			Iterator iter = basicComponents.iterator();
			while (iter.hasNext()) {
				String name = (String) iter.next();
				ComponentMetaDef componentMetaDef = basicComponents.getComponentMetaDef(name);
				xmlcontainerRegistry.registerComponentMetaDef(componentMetaDef);
			}
		} catch (Exception ex) {
			Debug.logError("[JdonFramework] register basiceComponents error:" + ex, module);
			throw new Exception(ex);
		}

	}
163857
public static void register(String name, Object instance) {
    try {
      Class<Object> mbeanInterface = guessMBeanInterface(instance);
      ManagementFactory.getPlatformMBeanServer().registerMBean(new StandardMBean(instance, mbeanInterface), new ObjectName(name));

    } catch (MalformedObjectNameException | NotCompliantMBeanException | InstanceAlreadyExistsException | MBeanRegistrationException e) {
      throw new IllegalStateException("Can not register MBean [" + name + "]", e);
    }
  }
184899
public static void register(BeanDefinitionRegistry registry, String... packageNames) {
		Assert.notNull(registry, "Registry must not be null");
		Assert.notNull(packageNames, "PackageNames must not be null");
		register(registry, Arrays.asList(packageNames));
	}
971514
public void registerBeanFactory(String theName, String groupName, final Class beanClass) {
        getProxyBuilder().registerFactory(theName, new AbstractFactory() {
            public Object newInstance(FactoryBuilderSupport builder, Object name, Object value,
                                      Map properties) throws InstantiationException, IllegalAccessException {
                if (checkValueIsTypeNotString(value, name, beanClass)) {
                    return value;
                } else {
                    return beanClass.newInstance();
                }
            }
        });
        getRegistrationGroup(groupName).add(theName);
    }
171382
public static void registerMbean(MBeanServer server, ModelMBean mbean, ObjectName name) {
        try {
            synchronized(LOCK) {
                if(server.isRegistered(name))
                    JmxUtils.unregisterMbean(server, name);
                server.registerMBean(mbean, name);
            }
        } catch(Exception e) {
            logger.error("Error registering mbean:", e);
        }
    }
1186863
private ObjectName registerMXBean(MBeanServer pServer, Object pObject, Class pManagementInterface, String pName) throws MalformedObjectNameException, NotCompliantMBeanException, InstanceAlreadyExistsException, MBeanRegistrationException {
        ObjectName objectName = new ObjectName(pName);
        final StandardMBean mxBean = new StandardMBean(pObject, pManagementInterface, true /* MXBean */);
        pServer.registerMBean(mxBean, objectName);
        System.out.println("Registered MXBean " + objectName);
        return objectName;
    }
1265333
@SuppressWarnings("unused")
    private void initalizeReferences(Collection<Bean> beans) {
        Map<BeanId, Bean> userProvided = BeanUtils.uniqueIndex(beans);
        for (Bean bean : beans) {
            for (String name : bean.getReferenceNames()) {
                List<BeanId> values = bean.getReference(name);
                if (values == null) {
                    continue;
                }
                for (BeanId beanId : values) {
                    // the does not exist in storage, but may exist in the
                    // set of beans provided by the user.
                    Bean ref = userProvided.get(beanId);
                    if (ref == null) {
                        Optional<Bean> optional = beanManager.getEager(beanId);
                        if (optional.isPresent()) {
                            ref = optional.get();
                        }
                    }
                    beanId.setBean(ref);
                    schemaManager.setSchema(Arrays.asList(beanId.getBean()));
                }
            }
        }
    }
8926
public void register(Class src, Class target) {
        List<BeanMappingObject> objects = BeanMappingParser.parseMapping(src, target);
        for (BeanMappingObject object : objects) {
            register(object);
        }
    }
953416
public void addServletRegistrationBeans(
			ServletRegistrationBean<?>... servletRegistrationBeans) {
		Assert.notNull(servletRegistrationBeans,
				"ServletRegistrationBeans must not be null");
		Collections.addAll(this.servletRegistrationBeans, servletRegistrationBeans);
	}
931213
public void setServletRegistrationBeans(
			Collection<? extends ServletRegistrationBean<?>> servletRegistrationBeans) {
		Assert.notNull(servletRegistrationBeans,
				"ServletRegistrationBeans must not be null");
		this.servletRegistrationBeans = new LinkedHashSet<>(servletRegistrationBeans);
	}
825796
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
		this.applicationContext = applicationContext;

		if (servletContext == null)
			if (applicationContext instanceof WebApplicationContext) {
				servletContext = ((WebApplicationContext) applicationContext).getServletContext();
				if (servletContext == null) {
					System.err.print("this class only fit for Spring Web Application");
					return;
				}

			}

		// start up jdon
		AppContextWrapper acw = new ServletContextWrapper(servletContext);
		ContainerFinder containerFinder = new ContainerFinderImp();
		containerWrapper = containerFinder.findContainer(acw);

	}