[weld-issues] [JBoss JIRA] (WELD-2410) Trimmed Bean Archive does not discover injection points for test cases

2017-08-08 Thread Martin Kouba (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Martin Kouba commented on  WELD-2410  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Trimmed Bean Archive does not discover injection points for test cases   
 

  
 
 
 
 

 
 

Without something like this, it makes tests basically unusable.
 Such tests should use an "intermediate" bean (annotated with a bean defining annotation) to inject the config properties if they're intended to work with trimmed bean archives. 

It seems unnatural to add a CDI annotation to something that's never managed as a CDI bean.
 Yet users do it very often, e.g. when using @Inject on a servlet. However, for Java EE components there's a special treatment, e.g. ProcessInjectionPoint must be fired for every injection point of every Java EE component class supporting injection.  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.2.3#72005-sha1:73be91d)  
 
 

 
   
 

  
 

  
 

   

___
weld-issues mailing list
weld-issues@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/weld-issues

[weld-issues] [JBoss JIRA] (WELD-2411) Registering a custom Bean of Type Provider doesn't resolve to the right class

2017-08-08 Thread Martin Kouba (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Martin Kouba commented on  WELD-2411  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Registering a custom Bean of Type Provider doesn't resolve to the right class   
 

  
 
 
 
 

 
 Test/reproducer? Also if you mark it as alternative do you have it selected in your test (beans.xml or custom bean must implement Prioritized)?  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.2.3#72005-sha1:73be91d)  
 
 

 
   
 

  
 

  
 

   

___
weld-issues mailing list
weld-issues@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/weld-issues

[weld-issues] [JBoss JIRA] (WELD-2410) Trimmed Bean Archive does not discover injection points for test cases

2017-08-08 Thread John Ament (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 John Ament commented on  WELD-2410  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Trimmed Bean Archive does not discover injection points for test cases   
 

  
 
 
 
 

 
 Right, and I lump Arquillian tests into that same bucket as Java EE components.  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.2.3#72005-sha1:73be91d)  
 
 

 
   
 

  
 

  
 

   

___
weld-issues mailing list
weld-issues@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/weld-issues

[weld-issues] [JBoss JIRA] (WELD-2411) Registering a custom Bean of Type Provider doesn't resolve to the right class

2017-08-08 Thread John Ament (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 John Ament commented on  WELD-2411  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Registering a custom Bean of Type Provider doesn't resolve to the right class   
 

  
 
 
 
 

 
 You can run the tests in the same repo, there's a provider test now. Prioritized was added in CDI 2.0, so can't really depend on that. How else would a programmatic bean be activated as an alternative back in Weld 2.x?  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.2.3#72005-sha1:73be91d)  
 
 

 
   
 

  
 

  
 

   

___
weld-issues mailing list
weld-issues@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/weld-issues

[weld-issues] [JBoss JIRA] (WELD-2411) Registering a custom Bean of Type Provider doesn't resolve to the right class

2017-08-08 Thread John Ament (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 John Ament commented on  WELD-2411  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Registering a custom Bean of Type Provider doesn't resolve to the right class   
 

  
 
 
 
 

 
 tested adding prioritized, that doesn't work either.  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.2.3#72005-sha1:73be91d)  
 
 

 
   
 

  
 

  
 

   

___
weld-issues mailing list
weld-issues@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/weld-issues

[weld-issues] [JBoss JIRA] (WELD-2410) Trimmed Bean Archive does not discover injection points for test cases

2017-08-08 Thread Martin Kouba (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Martin Kouba commented on  WELD-2410  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Trimmed Bean Archive does not discover injection points for test cases   
 

  
 
 
 
 

 
 John, I'm not sure I understand what you mean. In any case, Arquillian test classes are simply not in the same bucket as Java EE components.  In theory, a CDI extension could be used to add e.g. @Dependent annotation to a test class (e.g. types extending org.jboss.arquillian.testng.Arquillian or annotated with @RunWith(org.jboss.arquillian.junit.Arquillian.class)) - trimming should take this into account and hand test class over to bean discovery. Feel free to create an Arquillian issue. I'm going to reject this issue.  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.2.3#72005-sha1:73be91d)  
 
 

 
   
 

  
 

  
 

   

___
weld-issues mailing list
weld-issues@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/weld-issues

[weld-issues] [JBoss JIRA] (WELD-2411) Registering a custom Bean of Type Provider doesn't resolve to the right class

2017-08-08 Thread Martin Kouba (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Martin Kouba commented on  WELD-2411  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Registering a custom Bean of Type Provider doesn't resolve to the right class   
 

  
 
 
 
 

 
 

How else would a programmatic bean be activated as an alternative back in Weld 2.x?
 AFAIK there is no way to globally enable a custom bean in Weld 2.x. I get some java.lang.IllegalArgumentException: No configured value for 'org.apache.geronimo.config.test.internal.somekey' for ProviderTest. But even if I use -Dorg.apache.geronimo.config.test.internal.somekey=foo and select the alternative locally the custom bean is ignored. It might be that this is the first time anyone is trying to "override" a buil-in bean  I'm going to dig deeper.  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.2.3#72005-sha1:73be91d)  
 
 

 
   
 

  
 

  
 

   

___
weld-issues mailing list
weld-issues@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/weld-issues

[weld-issues] [JBoss JIRA] (WELD-2412) Consider adding WeldBeanConfigurator to API

2017-08-08 Thread Martin Kouba (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Martin Kouba created an issue  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 Weld /  WELD-2412  
 
 
  Consider adding WeldBeanConfigurator to API   
 

  
 
 
 
 

 
Issue Type: 
  Feature Request  
 
 
Assignee: 
 Unassigned  
 
 
Components: 
 Weld SPI  
 
 
Created: 
 08/Aug/17 7:56 AM  
 
 
Priority: 
  Major  
 
 
Reporter: 
 Martin Kouba  
 

  
 
 
 
 

 
 This configurator would allow to define alternative beans enabled for an application. See also https://issues.jboss.org/browse/CDI-711.  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.2.3#72005-sha1:73be91d)  
 

[weld-issues] [JBoss JIRA] (WELD-2411) Registering a custom Bean of Type Provider doesn't resolve to the right class

2017-08-08 Thread John Ament (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 John Ament commented on  WELD-2411  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Registering a custom Bean of Type Provider doesn't resolve to the right class   
 

  
 
 
 
 

 
 Ok. FWIW, simply making isAlternative() return true enables it for OWB.  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.2.3#72005-sha1:73be91d)  
 
 

 
   
 

  
 

  
 

   

___
weld-issues mailing list
weld-issues@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/weld-issues

[weld-issues] [JBoss JIRA] (WELD-2411) Registering a custom Bean of Type Provider doesn't resolve to the right class

2017-08-08 Thread Martin Kouba (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Martin Kouba commented on  WELD-2411  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Registering a custom Bean of Type Provider doesn't resolve to the right class   
 

  
 
 
 
 

 
 

FWIW, simply making isAlternative() return true enables it for OWB.
 That does not seem to be legal. And yes, I've just verified that Weld does not allow to "override" built-in beans such as Provider. I've also created a spec clarification issue: https://issues.jboss.org/browse/CDI-712.  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.2.3#72005-sha1:73be91d)  
 
 

 
   
 

  
 

  
 

   

___
weld-issues mailing list
weld-issues@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/weld-issues

[weld-issues] [JBoss JIRA] (WELD-2411) Registering a custom Bean of Type Provider doesn't resolve to the right class

2017-08-08 Thread Martin Kouba (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Martin Kouba updated an issue  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 Weld /  WELD-2411  
 
 
  Registering a custom Bean of Type Provider doesn't resolve to the right class   
 

  
 
 
 
 

 
Change By: 
 Martin Kouba  
 
 
Affects Version/s: 
 2.4.4.Final  
 
 
Affects Version/s: 
 3.0.0.Final  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.2.3#72005-sha1:73be91d)  
 
 

 
   
 

  
 

  
 

   

___
weld-issues mailing list
weld-issues@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/weld-issues

[weld-issues] [JBoss JIRA] (WELD-2410) Trimmed Bean Archive does not discover injection points for test cases

2017-08-08 Thread Martin Kouba (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Martin Kouba resolved as Rejected  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 Weld /  WELD-2410  
 
 
  Trimmed Bean Archive does not discover injection points for test cases   
 

  
 
 
 
 

 
Change By: 
 Martin Kouba  
 
 
Status: 
 Open Resolved  
 
 
Resolution: 
 Rejected  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.2.3#72005-sha1:73be91d)  
 
 

 
   
 

  
 

  
 

   

___
weld-issues mailing list
weld-issues@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/weld-issues

[weld-issues] [JBoss JIRA] (WELD-2411) Registering a custom Bean of Type Provider doesn't resolve to the right class

2017-08-08 Thread Mark Struberg (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Mark Struberg commented on  WELD-2411  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Registering a custom Bean of Type Provider doesn't resolve to the right class   
 

  
 
 
 
 

 
 Martin Kouba Where in the spec does it state that this is not legal? One could even create an Alternative for Instance and it would still be perfectly fine from a spec perspective!  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.2.3#72005-sha1:73be91d)  
 
 

 
   
 

  
 

  
 

   

___
weld-issues mailing list
weld-issues@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/weld-issues

[weld-issues] [JBoss JIRA] (WELD-2411) Registering a custom Bean of Type Provider doesn't resolve to the right class

2017-08-08 Thread Martin Kouba (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Martin Kouba commented on  WELD-2411  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Registering a custom Bean of Type Provider doesn't resolve to the right class   
 

  
 
 
 
 

 
 It's not legal if BeanAttributes.isAlternative() returns true but the custom bean is not selected - that's how I understand John's sentence "simply making isAlternative() return true enables it for OWB". In this case, the custom bean should be just ignored.  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.2.3#72005-sha1:73be91d)  
 
 

 
   
 

  
 

  
 

   

___
weld-issues mailing list
weld-issues@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/weld-issues

[weld-issues] [JBoss JIRA] (WELD-2411) Registering a custom Bean of Type Provider doesn't resolve to the right class

2017-08-08 Thread Mark Struberg (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Mark Struberg edited a comment on  WELD-2411  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Registering a custom Bean of Type Provider doesn't resolve to the right class   
 

  
 
 
 
 

 
 Oki, if I got this right then there might be 2 different things mixed up.Q1: is it allowed to register an Alternative to a built-in Bean, e.g. an @Alternative for Provider?Q2: what happens if you have an @Alternative Bean but there is no enabled Bean?Btw, I think it is perfectly allowed to have an Alternative Bean without any original Bean.{ noformat quote }5.2.1. Unsatisfied and ambiguous dependenciesAn unsatisfied dependency exists at an injection point when no bean is eligible for injection to the injection point. An ambiguous dependency exists at an injection point when multiple beans are eligible for injection to the injection point.Note that an unsatisfied or ambiguous dependency cannot exist for a decorator delegate injection point, defined in Section 8.1.2, “Decorator delegate injection points”.When an ambiguous dependency exists, the container attempts to resolve the ambiguity. The container eliminates all eligible beans that are not alternatives, except for producer methods and fields of beans that are alternatives. If there is exactly one bean remaining, the container will select this bean, and the ambiguous dependency is called resolvable.{ noformat quote }So from a pure spec perspective all the Alternative evaluation is ONLY done if there is an ambiguity in the first place!  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.2.3#72005-sha1:73be91d)  
 
 

 
   
 

  
 

  
 

   

___
weld-issues mailing list
weld-issues@lists.jboss.org
https://lists.jboss.org/mailman/listinfo

[weld-issues] [JBoss JIRA] (WELD-2411) Registering a custom Bean of Type Provider doesn't resolve to the right class

2017-08-08 Thread Mark Struberg (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Mark Struberg commented on  WELD-2411  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Registering a custom Bean of Type Provider doesn't resolve to the right class   
 

  
 
 
 
 

 
 Oki, if I got this right then there might be 2 different things mixed up. Q1: is it allowed to register an Alternative to a built-in Bean, e.g. an @Alternative for Provider? Q2: what happens if you have an @Alternative Bean but there is no enabled Bean? Btw, I think it is perfectly allowed to have an Alternative Bean without any original Bean.  
 
 
 
 
 5.2.1. Unsatisfied and ambiguous dependencies  
 
 
 An unsatisfied dependency exists at an injection point when no bean is eligible for injection to the injection point. An ambiguous dependency exists at an injection point when multiple beans are eligible for injection to the injection point.  
 
 
 Note that an unsatisfied or ambiguous dependency cannot exist for a decorator delegate injection point, defined in Section 8.1.2, “Decorator delegate injection points”.  
 
 
    
 
 
 When an ambiguous dependency exists, the container attempts to resolve the ambiguity. The container eliminates all eligible beans that are not alternatives, except for producer methods and fields of beans that are alternatives. If there is exactly one bean remaining, the container will select this bean, and the ambiguous dependency is called resolvable.
  
 
 
 
  So from a pure spec perspective all the Alternative evaluation is ONLY done if there is an ambiguity in the first place!  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  

[weld-issues] [JBoss JIRA] (WELD-2411) Registering a custom Bean of Type Provider doesn't resolve to the right class

2017-08-08 Thread Martin Kouba (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Martin Kouba commented on  WELD-2411  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Registering a custom Bean of Type Provider doesn't resolve to the right class   
 

  
 
 
 
 

 
 

Q2: what happens if you have an @Alternative Bean but there is no enabled Bean?
 No. What I meant is that if you register a custom bean where isAlternative() returns true, the bean must not be enabled unless it is explicitly selected for a bean archive (beans.xml) or for an application (Prioritized in CDI 2).  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.2.3#72005-sha1:73be91d)  
 
 

 
   
 

  
 

  
 

   

___
weld-issues mailing list
weld-issues@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/weld-issues