[jbosstools-issues] [JBoss JIRA] (JBIDE-17812) "No bean is eligible for injection" warning for beans added in AfterBeanDiscovery

Viacheslav Kabanovich (JIRA) issues at jboss.org
Mon Jul 14 14:40:29 EDT 2014


    [ https://issues.jboss.org/browse/JBIDE-17812?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12984893#comment-12984893 ] 

Viacheslav Kabanovich commented on JBIDE-17812:
-----------------------------------------------

To support a CDI extension in JBoss CDI tools, we write code that treats annotations as it is done in that extension, and 'hardcode' beans that should be added in any other way than by annotating. We do not implement CDI runtime to catch all extensions available in a project, we only mock it for extensions that we are aware of.

> "No bean is eligible for injection" warning for beans added in AfterBeanDiscovery
> ---------------------------------------------------------------------------------
>
>                 Key: JBIDE-17812
>                 URL: https://issues.jboss.org/browse/JBIDE-17812
>             Project: Tools (JBoss Tools)
>          Issue Type: Bug
>          Components: cdi-extensions
>            Reporter: Ron Šmeral
>            Assignee: Viacheslav Kabanovich
>             Fix For: 4.2.0.CR1
>
>
> JBDS shows _No bean is eligible for injection to the injection point_ warning for injection points where the beans are provided by an extension in the ABD event:
> {code:java|title=ByIdExtensionTest.java}
> @Inject @ById("rbenevides") 
> private Person rafael;
> {code}
> * shows _No bean is eligible for injection to the injection point \[JSR-299 §5.2.1\]_
> {code:java|title=ByIdExtension.java}
> public void afterBeanDiscovery(@Observes AfterBeanDiscovery abd, BeanManager bm) {
>     for (final String idValue : ids) {
>         BeanBuilder<Person> beanBuilder = new BeanBuilder<Person>(bm)
>                 .beanClass(Person.class)
>                 .types(Person.class, Object.
>                 .qualifiers(new ByIdLiteral(idValue))
>                 .beanLifecycle(new PersonContextualLifecycle(idValue));
>         abd.addBean(beanBuilder.create());
>     }
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.2.6#6264)



More information about the jbosstools-issues mailing list