You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a resource class is located in a WAR file which declares bean-discovery-mode="none" in beans.xml and that resource class has a constructor parameter annotated with @Context, then bootstrapping of the resource fails with the following error message: WELD-001530: Cannot produce an instance of class
Environment
Java 8
Jersey 2.30 as part of Payara Community Edition 5.2021.2
It seems this bug exists since rather long time (not just since 2.23), as it was reported on Stack Overflow more than four years ago.
Workaround
Replace constructor by @PostConstruct-annotated method (and in turn, use field injection)
The text was updated successfully, but these errors were encountered:
Thanks a lot Jan, for resolving this issue such quickly!
mkarg
changed the title
Fails to create resource instance when injecting @Context into constructor having bean-discovery-mode="none" on Jersey 2.23
Fails to create resource instance when injecting @Context into constructor having bean-discovery-mode="none" on Jersey 2.30
Apr 27, 2021
Problem Description
When a resource class is located in a WAR file which declares
bean-discovery-mode="none"
inbeans.xml
and that resource class has a constructor parameter annotated with@Context
, then bootstrapping of the resource fails with the following error message:WELD-001530: Cannot produce an instance of class
Environment
Workaround
@PostConstruct
-annotated method (and in turn, use field injection)The text was updated successfully, but these errors were encountered: