[jbosstools-issues] [JBoss JIRA] (JBIDE-15385) Support annotation @Priority
Viacheslav Kabanovich (JIRA)
jira-events at lists.jboss.org
Tue Sep 24 15:18:45 EDT 2013
[ https://issues.jboss.org/browse/JBIDE-15385?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12807026#comment-12807026 ]
Viacheslav Kabanovich commented on JBIDE-15385:
-----------------------------------------------
Test case.
Create CDI 1.1 project.
Create classes
{code}
package test;
import javax.enterprise.context.ApplicationScoped;
@ApplicationScoped
public class A {
}
{code}
{code}
package test;
import javax.annotation.Priority;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Alternative;
import static javax.interceptor.Interceptor.Priority.APPLICATION;
@ApplicationScoped
@Alternative
@Priority(APPLICATION + 200)
public class B extends A {
}
{code}
{code}
package test;
import javax.annotation.Priority;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Alternative;
import static javax.interceptor.Interceptor.Priority.APPLICATION;
@ApplicationScoped
@Alternative
@Priority(APPLICATION + 300)
public class C extends A {
}
{code}
{code}
package test;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
@ApplicationScoped
public class Test {
@Inject A a;
}
{code}
Check that injection Test.a is resolved to bean test.C.
In bean test.B change value in @Priority from 200 to 300.
Check that a warning 'Multiple beans...' appeared at injection Test.a.
In bean test.B change value in @Priority 400.
Check that the warning is disappeared and injection Test.a is resolved to bean test.B.
Add to test.B annotation @Vetoed (javax.enterprise.inject.Vetoed).
Check that injection Test.a is resolved to bean test.C.
> Support annotation @Priority
> ----------------------------
>
> Key: JBIDE-15385
> URL: https://issues.jboss.org/browse/JBIDE-15385
> Project: Tools (JBoss Tools)
> Issue Type: Sub-task
> Components: cdi
> Reporter: Viacheslav Kabanovich
> Assignee: Viacheslav Kabanovich
> Labels: new_and_noteworthy
> Fix For: 4.2.0.Alpha1
>
>
> An alternative can be annotated with Priority.
> {code}
> @Alternative @Priority(APPLICATION+100)
> public class MockAsynchronousService extends AsynchronousService {
> ...
> }
> {code}
> That makes it enabled without declaring it in beans.xml.
> Value of Priority is used to resolve ambiguous dependencies.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jbosstools-issues
mailing list