[weld-issues] [JBoss JIRA] (WELD-2411) Registering a custom Bean of Type Provider doesn't resolve to the right class
Title: Message Title Martin Kouba commented on WELD-2411 Re: Registering a custom Bean of Type Provider doesn't resolve to the right class Deferring until CDI-712 is resolved. Add Comment This message was sent by Atlassian JIRA (v7.5.0#75005-sha1:fd8c849) ___ 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
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 Fix Version/s: Unscheduled Add Comment This message was sent by Atlassian JIRA (v7.5.0#75005-sha1:fd8c849) ___ 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
Title: Message Title Martin Kouba commented on WELD-2411 Re: Registering a custom Bean of Type Provider doesn't resolve to the right class By the way, if you change the test like this: https://github.com/mkouba/geronimo-config/blob/owb-broken/impl/src/test/java/org/apache/geronimo/config/test/internal/ProviderTest.java#L66 It fails with OWB as well. 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
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, I understand the point with 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-2411) Registering a custom Bean of Type Provider doesn't resolve to the right class
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
[weld-issues] [JBoss JIRA] (WELD-2411) Registering a custom Bean of Type Provider doesn't resolve to the right class
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
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
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
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
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-2411) Registering a custom Bean of Type Provider doesn't resolve to the right class
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
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
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-2411) Registering a custom Bean of Type Provider doesn't resolve to the right class
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-2411) Registering a custom Bean of Type Provider doesn't resolve to the right class
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
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-2411) Registering a custom Bean of Type Provider doesn't resolve to the right class
Title: Message Title John Ament created an issue Weld / WELD-2411 Registering a custom Bean of Type Provider doesn't resolve to the right class Issue Type: Bug Assignee: Unassigned Created: 07/Aug/17 8:02 PM Priority: Major Reporter: John Ament https://github.com/apache/geronimo-config/blob/trunk/impl/src/main/java/org/apache/geronimo/config/cdi/ConfigExtension.java#L161 We register a custom bean of type provider, and mark it correctly as an alternative. Based on this, our custom bean should be registered as the bean in use rather than the default InstanceImpl that ships with Weld. However, we still get Weld's InstanceImpl. Add Comment This message was sent by Atlassian JIRA (v7.2.3#72005-sha1:73be