openwebbeans-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Struberg <>
Subject Re: An injection target does not have to be a managed bean
Date Tue, 08 Jan 2013 22:19:33 GMT
Hi Harald!

I think the log is ok, depending on the view. 

I think you are right that we don't need to create the Bean, but it doesn't hurt imo (apart
from taking a bit). We don't register the bean with the BeanManager anyway. The reason we
do this is for dependent scoped producers which use an InjectionPoint parameter.
InjectionPoint has a getBean() and despite this could theoretically be left as null, we had
quite a few cases where producers took the info from there. Now you could argue that those
producers are broken, that would be correct as well. 

I'll try to get feedback from the EG on this topic and what Weld does in that case. It's imo
a bit underspecified, but if Weld doesn't fill the bean then we can drop it as well I think.


----- Original Message -----
> From: Harald Wellmann <>
> To: "" <>
> Cc: 
> Sent: Monday, January 7, 2013 9:48 PM
> Subject: An injection target does not have to be a managed bean
>T he following class is not a managed bean, for lack of a default constructor:
> public class NotABean {
>     public NotABean(int i) {}
> }
> But the class is a legal (albeit trivial) injection target.
> When constructing an injection target for this class, OWB logs a spurious 
> message:
> AnnotatedType<NotABean> annotatedType = 
> beanManager.createAnnotatedType(NotABean.class);
> InjectionTarget<NotABean> injectionTarget = 
> beanManager.createInjectionTarget(annotatedType);
> 07.01.2013 21:35:53 
> org.apache.webbeans.component.creation.AnnotatedTypeBeanCreatorImpl 
> defineConstructor
> INFO: No suitable constructor found for injection target class : [class 
>]. produce() method does not work!
> This is confusing for end users. Moreover, the implementation of 
> createInjectionTarget() has the following line
> InjectionTargetBean<T> bean = 
> webBeansContext.getWebBeansUtil().defineManagedBean(type);
> While the INFO message might be debatable, this looks plain wrong to me: you are 
> constructing a Bean<T> for a T which is not a managed bean.
> The problem occured while using Wicket on TomEE [1].
> Is this a TODO for OWB, or just a user misconception?
> [1]
> Best regards,
> Harald

View raw message