[seam-issues] [JBoss JIRA] (SOLDER-116) BeanBuilder create beans that don't support InjectionPoint injection
Antoine Sabot-Durand (JIRA)
jira-events at lists.jboss.org
Wed Jul 17 10:41:26 EDT 2013
[ https://issues.jboss.org/browse/SOLDER-116?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Antoine Sabot-Durand closed SOLDER-116.
---------------------------------------
Resolution: Out of Date
> BeanBuilder create beans that don't support InjectionPoint injection
> --------------------------------------------------------------------
>
> Key: SOLDER-116
> URL: https://issues.jboss.org/browse/SOLDER-116
> Project: Solder
> Issue Type: Bug
> Components: Builders
> Affects Versions: 3.0.0.Final
> Environment: MacOS X 10.7 (apple jdk 6) with Arquillian and weld-ee-embedded-1.1 container or JBoss AS 7
> Reporter: Antoine Sabot-Durand
> Assignee: Jozef Hartinger
> Priority: Critical
>
> I wrote a bean like this one :
> {code:java}
> @MyQualifier
> public class MyBean {
> @Inject
> InjectionPoint ip;
> public String saySomething() {
> String value = "";
> if (ip != null)
> value = ip.getAnnotated().getAnnotation(MyQualifier.class).value();
> return "Hello CDI World " + value;
> }
> }
> {code}
> with MyQualifier being a simple qualifier with a non binding parameter value.
> And I wrote an extension which register another version of this bean without Qualifier
> {code:java}
> public class MyExtension implements Extension {
> @SuppressWarnings({ "unchecked", "rawtypes" })
> public void afterBeanDiscovery(@Observes AfterBeanDiscovery abd, BeanManager bm) {
> AnnotatedTypeBuilder annoBuilder = new AnnotatedTypeBuilder().readFromType(MyBean.class).removeFromClass(
> MyQualifier.class);
> AnnotatedType myAnnotatedType = annoBuilder.create();
> BeanBuilder beanBuilder = new BeanBuilder(bm).readFromType(myAnnotatedType);
> abd.addBean(beanBuilder.create());
> }
> }
> {code}
> When bootstrapping Weld I have the following exception :
> {noformat}
> org.jboss.weld.exceptions.DefinitionException: WELD-001405 Cannot inject [field] @Inject org.jboss.solderbug.MyBean.ip in a class which isnt a bean
> at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:280)
> at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:139)
> at org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:389)
> at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:371)
> at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:390)
> at org.jboss.arquillian.container.weld.ee.embedded_1_1.mock.TestContainer.startContainer(TestContainer.java:257)
> at org.jboss.arquillian.container.weld.ee.embedded_1_1.WeldEEMockContainer.deploy(WeldEEMockContainer.java:98)
> ...
> {noformat}
> If I comment the @Inject line in the bean everything is fine and I can use both version of the bean (with or without qualifier)
--
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 seam-issues
mailing list