[JBoss JIRA] (CDI-701) Should addSterotype trigger discovery of new annotated types?
by Guillermo González de Agüero (JIRA)
[ https://issues.jboss.org/browse/CDI-701?page=com.atlassian.jira.plugin.sy... ]
Guillermo González de Agüero commented on CDI-701:
--------------------------------------------------
Thanks [~antoinesabot-durand]! Really appreciated.
> Should addSterotype trigger discovery of new annotated types?
> -------------------------------------------------------------
>
> Key: CDI-701
> URL: https://issues.jboss.org/browse/CDI-701
> Project: CDI Specification Issues
> Issue Type: Clarification
> Components: Portable Extensions
> Reporter: Guillermo González de Agüero
> Fix For: 2.1 (Discussion)
>
>
> I've tried to post this question to the mailing list multiple times without success, so I fill an issue for it.
> I'm adding some annotations as stereotypes via an extension, with the purpose of converting into beans any classes annotated with them (JAX-RS resources in my specific case). What I'm facing is that classes with that annotations are still only discovered if they were to be discovered before. So when using discovery-mode="annotated", my JAX-RS resources are not passed to the @ProcessAnnotatedType event.
> WildFly automatically converts JAX-RS resources into @RequestScoped CDI beans, but looking at the code I saw it does that dealing directly with Weld APIs at server level, not on a portable manner at RESTEasy level.
> I haven't found any mention in the spec that my approach wouldn't work, but the TCK doesn't address this usecase, which makes me think it's not supported.
> Could you please clarify me the situation? Could this me changed on a future version?
> And the original email I sent:
> {quote}
> Hi,
>
> I have a question about the behavior of the "BeforeBeanDiscovery#add*()" methods.
>
> My usecase is the following: I'd want to convert all JAX-RS resources into CDI beans. That resources are all annotated with @Path. My understanding was that converting that annotation into a stereotype would make them eligible as bean types.
>
> Since I can't modify that annotation, I just created an extension that observes the BeforeBeanDiscovery event and converts @Path into a stereotype associated with the @RequestScoped annotation. But it doesn't work, neither on Weld nor on OpenWebBeans. The class is not discovered on the next ProcessAnnotatedType event.
>
> I haven't found anything in the spec that explicitly says that a "runtime added" bean defining annotation makes clases eligible for discovery. But I think is makes sense.
>
> Checking the TCK, test org.jboss.cdi.tck.tests.extensions.stereotype.StereotypeExtensionTest tests that the addition of the stereotype works, but doesn't cover my case of adding a stereotype to a non bean class.
>
> Is this expected to work that way? Is a bug on the TCK and implementations? Any other way to achieve my goal?
>
>
> Regards,
> Guillermo González de Agüero
> {quote}
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
7 years
[JBoss JIRA] (CDI-701) Should addSterotype trigger discovery of new annotated types?
by Antoine Sabot-Durand (JIRA)
[ https://issues.jboss.org/browse/CDI-701?page=com.atlassian.jira.plugin.sy... ]
Antoine Sabot-Durand updated CDI-701:
-------------------------------------
Fix Version/s: 2.1 (Discussion)
> Should addSterotype trigger discovery of new annotated types?
> -------------------------------------------------------------
>
> Key: CDI-701
> URL: https://issues.jboss.org/browse/CDI-701
> Project: CDI Specification Issues
> Issue Type: Clarification
> Components: Portable Extensions
> Reporter: Guillermo González de Agüero
> Fix For: 2.1 (Discussion)
>
>
> I've tried to post this question to the mailing list multiple times without success, so I fill an issue for it.
> I'm adding some annotations as stereotypes via an extension, with the purpose of converting into beans any classes annotated with them (JAX-RS resources in my specific case). What I'm facing is that classes with that annotations are still only discovered if they were to be discovered before. So when using discovery-mode="annotated", my JAX-RS resources are not passed to the @ProcessAnnotatedType event.
> WildFly automatically converts JAX-RS resources into @RequestScoped CDI beans, but looking at the code I saw it does that dealing directly with Weld APIs at server level, not on a portable manner at RESTEasy level.
> I haven't found any mention in the spec that my approach wouldn't work, but the TCK doesn't address this usecase, which makes me think it's not supported.
> Could you please clarify me the situation? Could this me changed on a future version?
> And the original email I sent:
> {quote}
> Hi,
>
> I have a question about the behavior of the "BeforeBeanDiscovery#add*()" methods.
>
> My usecase is the following: I'd want to convert all JAX-RS resources into CDI beans. That resources are all annotated with @Path. My understanding was that converting that annotation into a stereotype would make them eligible as bean types.
>
> Since I can't modify that annotation, I just created an extension that observes the BeforeBeanDiscovery event and converts @Path into a stereotype associated with the @RequestScoped annotation. But it doesn't work, neither on Weld nor on OpenWebBeans. The class is not discovered on the next ProcessAnnotatedType event.
>
> I haven't found anything in the spec that explicitly says that a "runtime added" bean defining annotation makes clases eligible for discovery. But I think is makes sense.
>
> Checking the TCK, test org.jboss.cdi.tck.tests.extensions.stereotype.StereotypeExtensionTest tests that the addition of the stereotype works, but doesn't cover my case of adding a stereotype to a non bean class.
>
> Is this expected to work that way? Is a bug on the TCK and implementations? Any other way to achieve my goal?
>
>
> Regards,
> Guillermo González de Agüero
> {quote}
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
7 years
[JBoss JIRA] (CDI-701) Should addSterotype trigger discovery of new annotated types?
by Antoine Sabot-Durand (JIRA)
[ https://issues.jboss.org/browse/CDI-701?page=com.atlassian.jira.plugin.sy... ]
Antoine Sabot-Durand commented on CDI-701:
------------------------------------------
Thank you for your feedback [~ggam]. As you can see in CDI-377 we had some issue in the past with BDA, but as others said we didn't discuss about BDA added at runtime.
We'll definitely try to clarify this for CDI 2.1 or see if we can this support at spec level.
> Should addSterotype trigger discovery of new annotated types?
> -------------------------------------------------------------
>
> Key: CDI-701
> URL: https://issues.jboss.org/browse/CDI-701
> Project: CDI Specification Issues
> Issue Type: Clarification
> Components: Portable Extensions
> Reporter: Guillermo González de Agüero
>
> I've tried to post this question to the mailing list multiple times without success, so I fill an issue for it.
> I'm adding some annotations as stereotypes via an extension, with the purpose of converting into beans any classes annotated with them (JAX-RS resources in my specific case). What I'm facing is that classes with that annotations are still only discovered if they were to be discovered before. So when using discovery-mode="annotated", my JAX-RS resources are not passed to the @ProcessAnnotatedType event.
> WildFly automatically converts JAX-RS resources into @RequestScoped CDI beans, but looking at the code I saw it does that dealing directly with Weld APIs at server level, not on a portable manner at RESTEasy level.
> I haven't found any mention in the spec that my approach wouldn't work, but the TCK doesn't address this usecase, which makes me think it's not supported.
> Could you please clarify me the situation? Could this me changed on a future version?
> And the original email I sent:
> {quote}
> Hi,
>
> I have a question about the behavior of the "BeforeBeanDiscovery#add*()" methods.
>
> My usecase is the following: I'd want to convert all JAX-RS resources into CDI beans. That resources are all annotated with @Path. My understanding was that converting that annotation into a stereotype would make them eligible as bean types.
>
> Since I can't modify that annotation, I just created an extension that observes the BeforeBeanDiscovery event and converts @Path into a stereotype associated with the @RequestScoped annotation. But it doesn't work, neither on Weld nor on OpenWebBeans. The class is not discovered on the next ProcessAnnotatedType event.
>
> I haven't found anything in the spec that explicitly says that a "runtime added" bean defining annotation makes clases eligible for discovery. But I think is makes sense.
>
> Checking the TCK, test org.jboss.cdi.tck.tests.extensions.stereotype.StereotypeExtensionTest tests that the addition of the stereotype works, but doesn't cover my case of adding a stereotype to a non bean class.
>
> Is this expected to work that way? Is a bug on the TCK and implementations? Any other way to achieve my goal?
>
>
> Regards,
> Guillermo González de Agüero
> {quote}
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
7 years
[JBoss JIRA] (CDI-701) Should addSterotype trigger discovery of new annotated types?
by Guillermo González de Agüero (JIRA)
[ https://issues.jboss.org/browse/CDI-701?page=com.atlassian.jira.plugin.sy... ]
Guillermo González de Agüero commented on CDI-701:
--------------------------------------------------
{quote}
Perhaps, but that would have to be added in 2.1 I think. You cannot expect a change to 1.2 spec at this point.
{quote}
I'm fine with it being added to 2.1. I was searching for a standard way to do it in 1.2, but If that's not possible (as it seems to be the case), I understand it should be clarified on the next version.
Regarding your idea about an API or SPI to add bean defining annotations, I guess that would need to work *before* any extensions are called, no? So it would only work when the user is responsible of bootstraping the container? Just trying to understand before going further. Please let me know if this is not the place to ask for it.
Thanks!
> Should addSterotype trigger discovery of new annotated types?
> -------------------------------------------------------------
>
> Key: CDI-701
> URL: https://issues.jboss.org/browse/CDI-701
> Project: CDI Specification Issues
> Issue Type: Clarification
> Components: Portable Extensions
> Reporter: Guillermo González de Agüero
>
> I've tried to post this question to the mailing list multiple times without success, so I fill an issue for it.
> I'm adding some annotations as stereotypes via an extension, with the purpose of converting into beans any classes annotated with them (JAX-RS resources in my specific case). What I'm facing is that classes with that annotations are still only discovered if they were to be discovered before. So when using discovery-mode="annotated", my JAX-RS resources are not passed to the @ProcessAnnotatedType event.
> WildFly automatically converts JAX-RS resources into @RequestScoped CDI beans, but looking at the code I saw it does that dealing directly with Weld APIs at server level, not on a portable manner at RESTEasy level.
> I haven't found any mention in the spec that my approach wouldn't work, but the TCK doesn't address this usecase, which makes me think it's not supported.
> Could you please clarify me the situation? Could this me changed on a future version?
> And the original email I sent:
> {quote}
> Hi,
>
> I have a question about the behavior of the "BeforeBeanDiscovery#add*()" methods.
>
> My usecase is the following: I'd want to convert all JAX-RS resources into CDI beans. That resources are all annotated with @Path. My understanding was that converting that annotation into a stereotype would make them eligible as bean types.
>
> Since I can't modify that annotation, I just created an extension that observes the BeforeBeanDiscovery event and converts @Path into a stereotype associated with the @RequestScoped annotation. But it doesn't work, neither on Weld nor on OpenWebBeans. The class is not discovered on the next ProcessAnnotatedType event.
>
> I haven't found anything in the spec that explicitly says that a "runtime added" bean defining annotation makes clases eligible for discovery. But I think is makes sense.
>
> Checking the TCK, test org.jboss.cdi.tck.tests.extensions.stereotype.StereotypeExtensionTest tests that the addition of the stereotype works, but doesn't cover my case of adding a stereotype to a non bean class.
>
> Is this expected to work that way? Is a bug on the TCK and implementations? Any other way to achieve my goal?
>
>
> Regards,
> Guillermo González de Agüero
> {quote}
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
7 years
[JBoss JIRA] (CDI-701) Should addSterotype trigger discovery of new annotated types?
by Matej Novotny (JIRA)
[ https://issues.jboss.org/browse/CDI-701?page=com.atlassian.jira.plugin.sy... ]
Matej Novotny commented on CDI-701:
-----------------------------------
bq. That would clarify the situation and avoid confusions.
Perhaps, but that would have to be added in 2.1 I think. You cannot expect a change to 1.2 spec at this point.
bq. Has that been already discussed in the past?
I don't recall a CDI issue regarding that.
If you wish to see a non-portable Weld option working in CDI 1.2 (Weld 2.x), I think it would be proper to file a Weld feature request issue.
> Should addSterotype trigger discovery of new annotated types?
> -------------------------------------------------------------
>
> Key: CDI-701
> URL: https://issues.jboss.org/browse/CDI-701
> Project: CDI Specification Issues
> Issue Type: Clarification
> Components: Portable Extensions
> Reporter: Guillermo González de Agüero
>
> I've tried to post this question to the mailing list multiple times without success, so I fill an issue for it.
> I'm adding some annotations as stereotypes via an extension, with the purpose of converting into beans any classes annotated with them (JAX-RS resources in my specific case). What I'm facing is that classes with that annotations are still only discovered if they were to be discovered before. So when using discovery-mode="annotated", my JAX-RS resources are not passed to the @ProcessAnnotatedType event.
> WildFly automatically converts JAX-RS resources into @RequestScoped CDI beans, but looking at the code I saw it does that dealing directly with Weld APIs at server level, not on a portable manner at RESTEasy level.
> I haven't found any mention in the spec that my approach wouldn't work, but the TCK doesn't address this usecase, which makes me think it's not supported.
> Could you please clarify me the situation? Could this me changed on a future version?
> And the original email I sent:
> {quote}
> Hi,
>
> I have a question about the behavior of the "BeforeBeanDiscovery#add*()" methods.
>
> My usecase is the following: I'd want to convert all JAX-RS resources into CDI beans. That resources are all annotated with @Path. My understanding was that converting that annotation into a stereotype would make them eligible as bean types.
>
> Since I can't modify that annotation, I just created an extension that observes the BeforeBeanDiscovery event and converts @Path into a stereotype associated with the @RequestScoped annotation. But it doesn't work, neither on Weld nor on OpenWebBeans. The class is not discovered on the next ProcessAnnotatedType event.
>
> I haven't found anything in the spec that explicitly says that a "runtime added" bean defining annotation makes clases eligible for discovery. But I think is makes sense.
>
> Checking the TCK, test org.jboss.cdi.tck.tests.extensions.stereotype.StereotypeExtensionTest tests that the addition of the stereotype works, but doesn't cover my case of adding a stereotype to a non bean class.
>
> Is this expected to work that way? Is a bug on the TCK and implementations? Any other way to achieve my goal?
>
>
> Regards,
> Guillermo González de Agüero
> {quote}
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
7 years
[JBoss JIRA] (CDI-701) Should addSterotype trigger discovery of new annotated types?
by Guillermo González de Agüero (JIRA)
[ https://issues.jboss.org/browse/CDI-701?page=com.atlassian.jira.plugin.sy... ]
Guillermo González de Agüero commented on CDI-701:
--------------------------------------------------
Thanks everyone for so fast respones!
[~manovotn] my original conclusion was exactly that (feature not supported by spec). Maybe the spec could incorporate a note regarding this, saying "Implementations are NOT MANDATED to treat stereotypes added by this method as bean defining annotations. Implementations are ALLOWED to do it in a non portable manner". That would clarify the situation and avoid confusions.
A way to add annotations to the set of "bean defining annotations" was what I was really looking for. I just wanted to clarify that the addStereotype() was not the way to go before creating a feature request. Has that been already discussed in the past?
> Should addSterotype trigger discovery of new annotated types?
> -------------------------------------------------------------
>
> Key: CDI-701
> URL: https://issues.jboss.org/browse/CDI-701
> Project: CDI Specification Issues
> Issue Type: Clarification
> Components: Portable Extensions
> Reporter: Guillermo González de Agüero
>
> I've tried to post this question to the mailing list multiple times without success, so I fill an issue for it.
> I'm adding some annotations as stereotypes via an extension, with the purpose of converting into beans any classes annotated with them (JAX-RS resources in my specific case). What I'm facing is that classes with that annotations are still only discovered if they were to be discovered before. So when using discovery-mode="annotated", my JAX-RS resources are not passed to the @ProcessAnnotatedType event.
> WildFly automatically converts JAX-RS resources into @RequestScoped CDI beans, but looking at the code I saw it does that dealing directly with Weld APIs at server level, not on a portable manner at RESTEasy level.
> I haven't found any mention in the spec that my approach wouldn't work, but the TCK doesn't address this usecase, which makes me think it's not supported.
> Could you please clarify me the situation? Could this me changed on a future version?
> And the original email I sent:
> {quote}
> Hi,
>
> I have a question about the behavior of the "BeforeBeanDiscovery#add*()" methods.
>
> My usecase is the following: I'd want to convert all JAX-RS resources into CDI beans. That resources are all annotated with @Path. My understanding was that converting that annotation into a stereotype would make them eligible as bean types.
>
> Since I can't modify that annotation, I just created an extension that observes the BeforeBeanDiscovery event and converts @Path into a stereotype associated with the @RequestScoped annotation. But it doesn't work, neither on Weld nor on OpenWebBeans. The class is not discovered on the next ProcessAnnotatedType event.
>
> I haven't found anything in the spec that explicitly says that a "runtime added" bean defining annotation makes clases eligible for discovery. But I think is makes sense.
>
> Checking the TCK, test org.jboss.cdi.tck.tests.extensions.stereotype.StereotypeExtensionTest tests that the addition of the stereotype works, but doesn't cover my case of adding a stereotype to a non bean class.
>
> Is this expected to work that way? Is a bug on the TCK and implementations? Any other way to achieve my goal?
>
>
> Regards,
> Guillermo González de Agüero
> {quote}
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
7 years
[JBoss JIRA] (CDI-701) Should addSterotype trigger discovery of new annotated types?
by Tomas Remes (JIRA)
[ https://issues.jboss.org/browse/CDI-701?page=com.atlassian.jira.plugin.sy... ]
Tomas Remes commented on CDI-701:
---------------------------------
TBH I don't think the excluded TCK test is helpful. I don't plan to add any such test to TCK 2.0.0.Final.
> Should addSterotype trigger discovery of new annotated types?
> -------------------------------------------------------------
>
> Key: CDI-701
> URL: https://issues.jboss.org/browse/CDI-701
> Project: CDI Specification Issues
> Issue Type: Clarification
> Components: Portable Extensions
> Reporter: Guillermo González de Agüero
>
> I've tried to post this question to the mailing list multiple times without success, so I fill an issue for it.
> I'm adding some annotations as stereotypes via an extension, with the purpose of converting into beans any classes annotated with them (JAX-RS resources in my specific case). What I'm facing is that classes with that annotations are still only discovered if they were to be discovered before. So when using discovery-mode="annotated", my JAX-RS resources are not passed to the @ProcessAnnotatedType event.
> WildFly automatically converts JAX-RS resources into @RequestScoped CDI beans, but looking at the code I saw it does that dealing directly with Weld APIs at server level, not on a portable manner at RESTEasy level.
> I haven't found any mention in the spec that my approach wouldn't work, but the TCK doesn't address this usecase, which makes me think it's not supported.
> Could you please clarify me the situation? Could this me changed on a future version?
> And the original email I sent:
> {quote}
> Hi,
>
> I have a question about the behavior of the "BeforeBeanDiscovery#add*()" methods.
>
> My usecase is the following: I'd want to convert all JAX-RS resources into CDI beans. That resources are all annotated with @Path. My understanding was that converting that annotation into a stereotype would make them eligible as bean types.
>
> Since I can't modify that annotation, I just created an extension that observes the BeforeBeanDiscovery event and converts @Path into a stereotype associated with the @RequestScoped annotation. But it doesn't work, neither on Weld nor on OpenWebBeans. The class is not discovered on the next ProcessAnnotatedType event.
>
> I haven't found anything in the spec that explicitly says that a "runtime added" bean defining annotation makes clases eligible for discovery. But I think is makes sense.
>
> Checking the TCK, test org.jboss.cdi.tck.tests.extensions.stereotype.StereotypeExtensionTest tests that the addition of the stereotype works, but doesn't cover my case of adding a stereotype to a non bean class.
>
> Is this expected to work that way? Is a bug on the TCK and implementations? Any other way to achieve my goal?
>
>
> Regards,
> Guillermo González de Agüero
> {quote}
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
7 years
[JBoss JIRA] (CDI-701) Should addSterotype trigger discovery of new annotated types?
by Matej Novotny (JIRA)
[ https://issues.jboss.org/browse/CDI-701?page=com.atlassian.jira.plugin.sy... ]
Matej Novotny commented on CDI-701:
-----------------------------------
Hello [~ggam]
While I agree that this functionality might be good to have around, I don't think the spec, as it is now, implies that it should work the way you describe.
That being said, you cannot add a TCK test which tests something not implied by spec, therefore -1 for TCK test.
On top of that, as Martin said, the implementation is likely to prove very challenging and therefore, it might be better to find an alternative solution, such as expanding the Bean Defining Annotation set before bootstrap. If we go that way, the TCK test would again be out of place.
> Should addSterotype trigger discovery of new annotated types?
> -------------------------------------------------------------
>
> Key: CDI-701
> URL: https://issues.jboss.org/browse/CDI-701
> Project: CDI Specification Issues
> Issue Type: Clarification
> Components: Portable Extensions
> Reporter: Guillermo González de Agüero
>
> I've tried to post this question to the mailing list multiple times without success, so I fill an issue for it.
> I'm adding some annotations as stereotypes via an extension, with the purpose of converting into beans any classes annotated with them (JAX-RS resources in my specific case). What I'm facing is that classes with that annotations are still only discovered if they were to be discovered before. So when using discovery-mode="annotated", my JAX-RS resources are not passed to the @ProcessAnnotatedType event.
> WildFly automatically converts JAX-RS resources into @RequestScoped CDI beans, but looking at the code I saw it does that dealing directly with Weld APIs at server level, not on a portable manner at RESTEasy level.
> I haven't found any mention in the spec that my approach wouldn't work, but the TCK doesn't address this usecase, which makes me think it's not supported.
> Could you please clarify me the situation? Could this me changed on a future version?
> And the original email I sent:
> {quote}
> Hi,
>
> I have a question about the behavior of the "BeforeBeanDiscovery#add*()" methods.
>
> My usecase is the following: I'd want to convert all JAX-RS resources into CDI beans. That resources are all annotated with @Path. My understanding was that converting that annotation into a stereotype would make them eligible as bean types.
>
> Since I can't modify that annotation, I just created an extension that observes the BeforeBeanDiscovery event and converts @Path into a stereotype associated with the @RequestScoped annotation. But it doesn't work, neither on Weld nor on OpenWebBeans. The class is not discovered on the next ProcessAnnotatedType event.
>
> I haven't found anything in the spec that explicitly says that a "runtime added" bean defining annotation makes clases eligible for discovery. But I think is makes sense.
>
> Checking the TCK, test org.jboss.cdi.tck.tests.extensions.stereotype.StereotypeExtensionTest tests that the addition of the stereotype works, but doesn't cover my case of adding a stereotype to a non bean class.
>
> Is this expected to work that way? Is a bug on the TCK and implementations? Any other way to achieve my goal?
>
>
> Regards,
> Guillermo González de Agüero
> {quote}
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
7 years
[JBoss JIRA] (CDI-701) Should addSterotype trigger discovery of new annotated types?
by Guillermo González de Agüero (JIRA)
[ https://issues.jboss.org/browse/CDI-701?page=com.atlassian.jira.plugin.sy... ]
Guillermo González de Agüero commented on CDI-701:
--------------------------------------------------
Thanks [~mkouba] for pointing me to that issue. The interesting fact is that it didn't work on TomEE either (with OpenWebBeans). That what led me to think it was not supported by the spec.
I was aware of the trimmed discovery mode, but I'm still relying on Java EE 7 application servers and for people like me, there's unfortunately still a journey before we can use CDI 2. But anyway, what I'm trying to do is a library that would be put into the classpath of a war, so I wouldn't be in control of the discovery mode of the war itself.
Since this is required to work by the spec, could a test be added to the TCK? I understand that would put us in a complicated situation, where the RI wouldn't pass it, but the fact is that the absence of that test makes it difficult to know whether it's expected to work or no (to the point that the other certified implementation doesn't work either). Would a disabled test do the trick? It wouldn't hurt certifications, but users looking at it (like me in this case) would be alerted that there's a bug.
> Should addSterotype trigger discovery of new annotated types?
> -------------------------------------------------------------
>
> Key: CDI-701
> URL: https://issues.jboss.org/browse/CDI-701
> Project: CDI Specification Issues
> Issue Type: Clarification
> Components: Portable Extensions
> Reporter: Guillermo González de Agüero
>
> I've tried to post this question to the mailing list multiple times without success, so I fill an issue for it.
> I'm adding some annotations as stereotypes via an extension, with the purpose of converting into beans any classes annotated with them (JAX-RS resources in my specific case). What I'm facing is that classes with that annotations are still only discovered if they were to be discovered before. So when using discovery-mode="annotated", my JAX-RS resources are not passed to the @ProcessAnnotatedType event.
> WildFly automatically converts JAX-RS resources into @RequestScoped CDI beans, but looking at the code I saw it does that dealing directly with Weld APIs at server level, not on a portable manner at RESTEasy level.
> I haven't found any mention in the spec that my approach wouldn't work, but the TCK doesn't address this usecase, which makes me think it's not supported.
> Could you please clarify me the situation? Could this me changed on a future version?
> And the original email I sent:
> {quote}
> Hi,
>
> I have a question about the behavior of the "BeforeBeanDiscovery#add*()" methods.
>
> My usecase is the following: I'd want to convert all JAX-RS resources into CDI beans. That resources are all annotated with @Path. My understanding was that converting that annotation into a stereotype would make them eligible as bean types.
>
> Since I can't modify that annotation, I just created an extension that observes the BeforeBeanDiscovery event and converts @Path into a stereotype associated with the @RequestScoped annotation. But it doesn't work, neither on Weld nor on OpenWebBeans. The class is not discovered on the next ProcessAnnotatedType event.
>
> I haven't found anything in the spec that explicitly says that a "runtime added" bean defining annotation makes clases eligible for discovery. But I think is makes sense.
>
> Checking the TCK, test org.jboss.cdi.tck.tests.extensions.stereotype.StereotypeExtensionTest tests that the addition of the stereotype works, but doesn't cover my case of adding a stereotype to a non bean class.
>
> Is this expected to work that way? Is a bug on the TCK and implementations? Any other way to achieve my goal?
>
>
> Regards,
> Guillermo González de Agüero
> {quote}
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
7 years
[JBoss JIRA] (CDI-701) Should addSterotype trigger discovery of new annotated types?
by Martin Kouba (JIRA)
[ https://issues.jboss.org/browse/CDI-701?page=com.atlassian.jira.plugin.sy... ]
Martin Kouba commented on CDI-701:
----------------------------------
In fact, in CDI 2.0 a workaround/solution would be to use [trimmed explicit bean archive|https://docs.jboss.org/cdi/spec/2.0-PFD/cdi-spec.html#trimmed_bea...] instead of implicit bean archive + an extension that would add a scope annotation to all resources annotated with {{@Path}}.
> Should addSterotype trigger discovery of new annotated types?
> -------------------------------------------------------------
>
> Key: CDI-701
> URL: https://issues.jboss.org/browse/CDI-701
> Project: CDI Specification Issues
> Issue Type: Clarification
> Components: Portable Extensions
> Reporter: Guillermo González de Agüero
>
> I've tried to post this question to the mailing list multiple times without success, so I fill an issue for it.
> I'm adding some annotations as stereotypes via an extension, with the purpose of converting into beans any classes annotated with them (JAX-RS resources in my specific case). What I'm facing is that classes with that annotations are still only discovered if they were to be discovered before. So when using discovery-mode="annotated", my JAX-RS resources are not passed to the @ProcessAnnotatedType event.
> WildFly automatically converts JAX-RS resources into @RequestScoped CDI beans, but looking at the code I saw it does that dealing directly with Weld APIs at server level, not on a portable manner at RESTEasy level.
> I haven't found any mention in the spec that my approach wouldn't work, but the TCK doesn't address this usecase, which makes me think it's not supported.
> Could you please clarify me the situation? Could this me changed on a future version?
> And the original email I sent:
> {quote}
> Hi,
>
> I have a question about the behavior of the "BeforeBeanDiscovery#add*()" methods.
>
> My usecase is the following: I'd want to convert all JAX-RS resources into CDI beans. That resources are all annotated with @Path. My understanding was that converting that annotation into a stereotype would make them eligible as bean types.
>
> Since I can't modify that annotation, I just created an extension that observes the BeforeBeanDiscovery event and converts @Path into a stereotype associated with the @RequestScoped annotation. But it doesn't work, neither on Weld nor on OpenWebBeans. The class is not discovered on the next ProcessAnnotatedType event.
>
> I haven't found anything in the spec that explicitly says that a "runtime added" bean defining annotation makes clases eligible for discovery. But I think is makes sense.
>
> Checking the TCK, test org.jboss.cdi.tck.tests.extensions.stereotype.StereotypeExtensionTest tests that the addition of the stereotype works, but doesn't cover my case of adding a stereotype to a non bean class.
>
> Is this expected to work that way? Is a bug on the TCK and implementations? Any other way to achieve my goal?
>
>
> Regards,
> Guillermo González de Agüero
> {quote}
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
7 years