Hi All,
Can you please explain me this one, I have confusion which one is better.
1.
Bean<MyBean> bean = (Bean<MyBean>)
beanManager.resolve(beanManager.getBeans(MyBean.class));
MyBean= (MyBean) beanManager.getReference(bean, bean.getBeanClass(),
beanManager.createCreationalContext(bean));
2.
Bean<MyBean> bean = (Bean<MyBean>)
beanManager.resolve(beanManager.getBeans(MyBean.class));
MyBean bean = beanManager.getContext(bean.getScope()).get(bean,
beanManager.createCreationalContext(bean));
As i know BeanManager.getReference() always creates a whole new proxy
instance, while the Context.get() reuses an existing proxy instance if
already created before.
Is BeanManager.getReference() is more use full than Context.get() ??
Thanks
Muhammad Asif Bhutto