New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WFLY-16545] Register the @Provider, @Path and @ApplicationPath annot… #15706
Conversation
These failures are valid. I've not looked into yet as maybe we don't want to end up doing this as it does cause issues with deployments that were previously not processed as beans. This is the reason it's now a draft. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at Linux - JDK 11
CI run, there are failures in CoordinatorTestCase
. These are because org.wildfly.test.extension.rts.common.WorkRestATResource
is marked as final
and that will fail if it needs to create any subclass (which is always the case for normal scoped beans such as application scoped, or if you need to intercept/decorate these beans).
And I think all of these resources are going to be @ApplicationScoped
, right? That's what's done in org.jboss.resteasy.cdiResteasyCdiExtension
IIRC.
Does jaxrs spec say anything about these resources being final?
In the OpenAPIMultiModuleDeploymentIndexTestCase
I am not sure what's the problem. It seems like the EJB is not recognized but nothing has changes WRT that.This might actually be the case you described where the deployment wasn't a bean archive previously (this test uses EAR with WAR and EJB jar)?
...m/src/main/java/org/jboss/as/weld/deployment/processors/BeanDefiningAnnotationProcessor.java
Show resolved
Hide resolved
@manovotn Interestingly enough, no it doesn't say anything about whether a resource can be final. There is an example of a The default scope for resources is |
+1, those classes are not proxyable according to CDI spec |
@manovotn This has some information on why this was not done before https://issues.redhat.com/browse/WFLY-2859. Well done, but reverted it seems. |
@jamezp right, that's exactly what we talked about - that some archives that were not bean archive now will be which can in turn lead to some side effects. |
@manovotn I definitely agree with you. Especially since the REST spec states that if CDI is available that applications, providers and resources MUST be CDI beans. I guess really it's an argument of should we mark the deployment as a CDI deployment if it contains any of those. |
Right, this should be really brought up to the spec. If you create an issue, I can pitch in with CDI perspective in case it's needed. Also note that there is a possible scenario in which you can have an archive with REST bits that should become beans but there can be |
52c21a1
to
08e6fec
Compare
// happen, in which case these can be removed. | ||
addAnnotation(deploymentUnit, new AnnotationType(PROVIDER, false)); | ||
addAnnotation(deploymentUnit, new AnnotationType(APPLICATION_PATH, false)); | ||
addAnnotation(deploymentUnit, new AnnotationType(PATH, false)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jamezp I think these names (or perhaps the AnnotationType objects), and any others handled this way in this DUP, that are not required by the CDI spec itself should be passed in by the relevant subsystem using a new method in WeldCapability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would that happen early enough though? Weld needs to know the full set of bean defining annotations before it analyses any archive in order to determine if the archive is a bean archive in the first place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could add a DUP which executes between PARSE_CDI_BEAN_DEFINING_ANNOTATIONS
and PARSE_WELD_DEPLOYMENT
. There would be room for 128 different processors between those so that does seem reasonable.
I'll update the PR locally and do some testing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bstansberry @manovotn We could do something like this jamezp@eeb1369. It passed the single tests I added. I'll run the full test suite too and see how it does. It needs some cleanup, but that was a quick test. Using a DUP requires subsystems to have a dependency on org.jboss.as.weld
which didn't seem right. This keeps the dependency on org.jboss.as.weld.common
.
I updated the commit as I missed something in it, but the branch is https://github.com/jamezp/wildfly/tree/WFLY-16545-redo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a subsystem attribute like James did is what I had in mind. The values get provided to the weld subsystem object before any DUP runs.
Got it, makes sense.
the existing WeldCapability should be fine.
+1, let's reuse that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, right. It's a capability runtime API so it's not created and added very early. I'll update the PR as I think that makes the most sense.
…ations as bean defining annotations. https://issues.redhat.com/browse/WFLY-16545 Signed-off-by: James R. Perkins <jperkins@redhat.com>
I unfortunately don't think this is going to work. Section 3.1.2 of the specification states:
There is no way I'm aware of in CDI to support cases like this. |
Don't you already support that via wrapping of Alternatively, those parameters would need to be beans and I have no idea if that is doable under current state or how RE handles them ATM. |
Given a Zulip conversation with @manovotn about clarification we likely need in the REST spec, I'm going to close this for now. I'll leave the JIRA open for the time being. There might be some workarounds for this, but the constructor parameter injection is a real issue that could break users. |
…ations as bean defining annotations.
https://issues.redhat.com/browse/WFLY-16545
Note the some what of a revert back to an empty
beans.xml
for these tests as@ApplicationScoped
was added to theCDIBean
. This was the requirement for thebean-discovery-mode="all"
. However, by defining the scope on the bean that resolves the bean discovery issue.