[ 
https://issues.apache.org/jira/browse/OWB-1097?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14993607#comment-14993607
 ] 

Mark Struberg commented on OWB-1097:
------------------------------------

I'm not quite sure where you read that we must not fire ProcessInjectionTarget 
for manually created InjectionTargets?

spec says 
"The container must fire an event for every Java EE component class supporting 
injection that may be instantiated by the container at runtime, including every 
managed bean declared using @ManagedBean, EJB session or message-driven bean, 
bean, interceptor or decorator."

Please note that 12.4.3. "Bean discovery" doesn't define an absolute ordring of 
events but only "For every type in the set of discovered types" the order is 
specified. It's not even specified if that ordering is 
* PAT for all classes, ProcessBeanAttributes for all classes, 
ProcessInjectionTarget for all classes, etc
or
* for all classes do (PAT, ProcessBeanAttributes, ProcessInjectionTarget,..) 
(might even be done in parallel for WARs, e.g. in TomEE)

I'm not quite sure if it makes sense to send this Container event even at 
runtime ;) But it's not as clearly defined as you think imo.

Let's start a bit different: What do you like to achieve with that code? What 
is the goal and what problem do you like to solve? Maybe we can get to a quick 
solution that way.


> ProcessInjectionTarget event is fired when BeanManager.createInjectionTarget 
> or InjectionTargetFactory.createInjectionTarget is called
> --------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: OWB-1097
>                 URL: https://issues.apache.org/jira/browse/OWB-1097
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Lifecycle
>    Affects Versions: 1.6.2
>            Reporter: Antonin Stefanutti
>            Assignee: Mark Struberg
>
> In the following example:
> {code}
> class CdiCamelExtension implements Extension {
>     <T extends CamelContext> void camelContextBeans(@Observes 
> ProcessInjectionTarget<T> pit) {
>     }
>     void addDefaultCamelContext(@Observes AfterBeanDiscovery abd, BeanManager 
> manager) {  
>         
> manager.createInjectionTarget(manager.createAnnotatedType(DefaultCamelContext.class));
>  
>         manager.getInjectionTargetFactory(
>             manager.createAnnotatedType(DefaultCamelContext.class))
>                 .createInjectionTarget((Bean<DefaultCamelContext>) 
> manager.resolve(manager.getBeans(DefaultCamelContext.class)));
>     }
> }
> {code}
> Both calls to {{BeanManager.createInjectionTarget}} or 
> {{InjectionTargetFactory.createInjectionTarget}} triggers the firing of the 
> {{ProcessInjectionTarget}} event.
> From my understanding of the specification, that should not be the case. What 
> is surprising as well is that the {{ProcessInjectionTarget}} observer method 
> is called within the execution of the {{AfterBeanDiscovery}} observer method.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to