ctx.getComponentDefinitionRegistry().registerComponentDefinition(
factory);
MutableBeanMetadata meta = (MutableBeanMetadata) ctx
.createMetadata(BeanMetadata.class);
MutableRefMetadata ref = (MutableRefMetadata) ctx
.createMetadata(RefMetadata.class);
ref.setComponentId(factory.getId());
meta.setFactoryComponent(ref);
meta.setActivation(factory.getActivation());
meta.setFactoryMethod("createEntityManager");
meta.setScope(BeanMetadata.SCOPE_PROTOTYPE);
meta.setDestroyMethod("internalClose");