About an official CDI tutorial
by Antoine Sabot-Durand
Hi,
There have been discussion on the CDI spec ML about providing an official CDI tutorial (implementation agnostic)[1]. Pete launched the idea of using part of Weld documentation after cleaning it from all Weld references except for the credit.
Before going further I wanted to check with you if were comfortable with this idea and get your input or suggestion on that matter.
Many thanks
[1] http://cdi-specification-mailing-list.26218.n7.nabble.com/Having-an-offic...
Antoine Sabot-Durand
———————————————
Twitter : @antoine_sd
CDI co-spec lead & eco-system development
Agorava tech lead
10 years, 12 months
BeanManager.getReference() VS Context.get()
by Muhammad Bhutto
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
11 years
Issue with weld 2.1.0.Final on OSGI
by Charles Moulliard
Hi,
The following code which is working fine and returns a bean when we run
Junit Test with DeltaSpike does not work when Weld 2.1.0.Final is
deployed on Karaf (OSGI v4.3) with Pax-CDI. Apparently the bean is not
retrieved when we call "beanManager.getBeans("
protected CamelContext getCamelContext(String context, BeanManager
beanManager) {
if (camelContextMap == null) {
Set<Bean<?>> beans =
beanManager.getBeans(CamelContextMap.class, new AnyLiteral()); // return
null
Bean<?> bean = beanManager.resolve(beans); // return null
CreationalContext<?> creationalContext =
beanManager.createCreationalContext(bean);
camelContextMap = (CamelContextMap)
beanManager.getReference(bean, bean.getBeanClass(), creationalContext);
ObjectHelper.notNull(camelContextMap, "Could not resolve
CamelContextMap");
}
return camelContextMap.getCamelContext(context);
}
Question : How does WeldContainer loads the class when we use getBeans
as I suspect that we have a problem with the classloader used ?
Regards,
Charles
11 years
Difference behavior between Weld 1 and 2 on EL resolution and InjectionPoint
by Antoine Sabot-Durand
Hi all,
I’m experiencing what I think being a regression and a specification violation.
In my use case I have a producer annotated with @Named injecting an InjectionPoint:
@Produces
@Named
public OAuthSession getCurrentSession(InjectionPoint ip) {…}
When I call #{currentSession} in JSF with Weld 1.x producer is called with InjectionPoint set to null. Now with weld 2.x an exception is thrown by InjectionPointBean.getInjectionPoint() method.
Form what I understand from section 6.5.3. Contextual reference for a bean of the CDI 1.1 spec, the behavior should the Weld 1.X one : returning null instead of throwing an exception. I may be wrong but I can’t find anything in the spec about that.
Thanks for your feedback on that point,
Antoine Sabot-Durand
———————————————
Senior Software engineer
CDI co-spec lead
CDI eco-system development
11 years
Re: [weld-dev] Fwd: Issue with weld 2.1.0.Final on OSGI
by Charles Moulliard
Done a comparaison between beanTypes resolved when running a junit test
using weld 2.1.0.Final + DeltaSpike + camel vs Weld 2.1.0.Final + Camel
+ PaxCDI on Karaf and it appears that my class CamelContextBean is not
listed. This is why I get a NPE. So I supect again a classloading issue
when WeldContainer loads the classes of a bundle including also classes
to be imported from another bundle ....
https://gist.github.com/7384007 <https://gist.github.com/7384007>
On 08/11/13 19:15, Charles Moulliard wrote:
> FYI
>
>
> -------- Original Message --------
> Subject: Issue with weld 2.1.0.Final on OSGI
> Date: Fri, 08 Nov 2013 19:11:59 +0100
> From: Charles Moulliard <cmoulliard(a)redhat.com>
> To: weld-dev(a)lists.jboss.org, Antoine Sabot-Durand
> <asabotdu(a)redhat.com>, Jason Porter <jporter(a)redhat.com>, Peter Muir
> <pmuir(a)redhat.com>
>
>
>
> Hi,
>
> The following code which is working fine and returns a bean when we run
> Junit Test with DeltaSpike does not work when Weld 2.1.0.Final is
> deployed on Karaf (OSGI v4.3) with Pax-CDI. Apparently the bean is not
> retrieved when we call "beanManager.getBeans("
>
>
> protected CamelContext getCamelContext(String context, BeanManager
> beanManager) {
> if (camelContextMap == null) {
> Set<Bean<?>> beans =
> beanManager.getBeans(CamelContextMap.class, new AnyLiteral()); // return
> null
> Bean<?> bean = beanManager.resolve(beans); // return null
> CreationalContext<?> creationalContext =
> beanManager.createCreationalContext(bean);
> camelContextMap = (CamelContextMap)
> beanManager.getReference(bean, bean.getBeanClass(), creationalContext);
> ObjectHelper.notNull(camelContextMap, "Could not resolve
> CamelContextMap");
> }
> return camelContextMap.getCamelContext(context);
> }
>
> Question : How does WeldContainer loads the class when we use getBeans
> as I suspect that we have a problem with the classloader used ?
>
> Regards,
>
> Charles
>
>
>
>
11 years