You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openwebbeans.apache.org by "Mark Struberg (JIRA)" <ji...@apache.org> on 2017/12/06 12:34:00 UTC

[jira] [Commented] (OWB-1171) @Priority and @Alternative as sterotype

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

Mark Struberg commented on OWB-1171:
------------------------------------

* having @Alternative + @Priority on the stereotype is not allowed as clarified with fellow CDI EG members
* having the @Alternative on the stereotype and enlisting it in beans.xml works
* having the sterotype + @Priority on the class might be missing for now. Will add a unit test for it.

> @Priority and @Alternative as sterotype
> ---------------------------------------
>
>                 Key: OWB-1171
>                 URL: https://issues.apache.org/jira/browse/OWB-1171
>             Project: OpenWebBeans
>          Issue Type: Bug
>            Reporter: Alexander Falb
>
> In our projekt we have an annotation for mock services
> {code}
> @Stereotype
> @Retention(RUNTIME)
> @Target(TYPE)
> @ApplicationScoped
> @Alternative
> @Priority(1000)
> public @interface ServiceMock {}
> {code}
> that we use like
> {code}
> @ServiceMock
> MockUserServiceImpl implements UserService {}
> {code}
> which does not work, the non-mock implementation of {{UserService}} gets injected. 
> According to the CDI spec 1.2 chapter 2.8 {{@Priority}} is not supported as sterotyp, so we moved it to the class, which does not work either, but it should!?
> If we move both {{@Priority}} and {{@Alternative}} to the class, everything works as expected, but then the sterotype is useless.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)