You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openwebbeans.apache.org by "icarus (JIRA)" <ji...@apache.org> on 2013/11/05 15:51:17 UTC

[jira] [Updated] (OWB-912) Weird Behavior with @Specializes and @Inject @Any

     [ https://issues.apache.org/jira/browse/OWB-912?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

icarus updated OWB-912:
-----------------------

    Attachment: Webmodul.zip

Example Project (Maven)

> Weird Behavior with @Specializes and @Inject @Any
> -------------------------------------------------
>
>                 Key: OWB-912
>                 URL: https://issues.apache.org/jira/browse/OWB-912
>             Project: OpenWebBeans
>          Issue Type: Bug
>            Reporter: icarus
>         Attachments: Webmodul.zip
>
>
> Hello, in my Project I use a ServletContextListener to execute code after the Application is deployed.
> I have a interface “StartListener” with a single Metod, void onStart(), and all classes that implement this interface are injected in my ServletContextListener with @Inject @All.
> In a loop I execute the onStart() Method of every StartListener.
> It works as expected.
> In my Sample Project I have 3 classes (StartListenerImpl1 – StartListenerImpl3) that implement the interface and just log their name. So if I deploy the Application I see in the log:
> StartListenerImpl1
> StartListenerImpl2
> StartListenerImpl3
> Now I add another class SpecialStartListenerImpl that extends StartListenerImpl1. I annotate it with @Specializes, overwrite the onStart() Method to log SpecialStartListenerImpl and deploy the application.
> What I expect to see in the log:
> SpecialStartListenerImpl 
> StartListenerImpl2
> StartListenerImpl3
> What is in the logs if I deploy the application to Tomee 1.6
> SpecialStartListenerImpl 
> StartListenerImpl2 and StartListenerImpl3 were not instantiate and not injected in the ServletContextListener. @Specializes did not only deactivate StartListenerImpl1 but also StartListenerImpl2 and StartListenerImpl3. This is of course not what I wanted.
> If I deploy the same application on Glassfish 4.0 I get what I expect:
> SpecialStartListenerImpl 
> StartListenerImpl2
> StartListenerImpl3
> I created an Thread in the TomEE forum. Link: 
> http://openejb.979440.n4.nabble.com/Weird-Behavior-with-Specializes-and-Inject-Any-td4665967.html#a4665971
> Romain Manni-Bucau already created a patch that is also linked in the thread. 
> I will upload my sample project here as well. 



--
This message was sent by Atlassian JIRA
(v6.1#6144)