-
Clarification
-
Resolution: Won't Do
-
Major
-
None
-
1.2.Final
-
None
-
WildflySwarm 2017.7.0 and Weld 2.4.3.Final.
In looking into the use of javax.inject.Provider wrapped injection point values when dealing with @RequestScoped producers:
@Inject
@Claim(standard = Claims.iat)
private Provider<Long> providerIAT;
@Produces
@Claim(standard = Claims.iat)
@RequestScoped
Long getIAT() {
JsonWebToken jwt = getJWTPrincpal();
if (jwt == null) {
System.out.printf("getIAT, null JsonWebToken\n");
return null;
}
System.out.printf("getIAT\n");
return jwt.getIssuedAtTime();
}
I ran into the following exception:
Caused by: org.jboss.weld.exceptions.UnproxyableResolutionException: WELD-001437: Bean type class java.lang.Long is not proxyable because it is final - {2}.
at org.jboss.weld.util.Proxies.getUnproxyableClassException(Proxies.java:218)
at org.jboss.weld.util.Proxies.getUnproxyableTypeException(Proxies.java:182)
at org.jboss.weld.util.Proxies.getUnproxyableTypeException(Proxies.java:144)
at org.jboss.weld.bean.proxy.ClientProxyProvider.getClientProxy(ClientProxyProvider.java:242)
at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:736)
at org.jboss.weld.bean.builtin.InstanceImpl.getBeanInstance(InstanceImpl.java:189)
at org.jboss.weld.bean.builtin.InstanceImpl.get(InstanceImpl.java:100)
at org.eclipse.microprofile.jwt.test.jaxrs.RolesEndpoint.getInjectedIssuer(RolesEndpoint.java:269)
The spec is not really clear on why this should happen as the javax.inject.Provider is a proxy for the underlying type. It seems to me that this should be allowed, and that the exception I'm seeing from Weld-2.4.3.Final is a bug, but I wanted to get a clarification on why this might be disallowed.