[weld-dev] Injection Services cannot handler producer on a static field

Emily Jiang emijiang6 at googlemail.com
Thu May 14 17:47:20 EDT 2015


I am trying to run cdi cts and failed on the following test:
org.jboss.cdi.tck.tests.implementation.simple.resource.ws.staticProducer.WebServiceResourceStaticProducerFieldTest.testResourceProduced(WebServiceResourceStaticProducerFieldTest.java:46)

The test is to test the following produer:
@Produces @WebServiceRef private static MyClass wsRef;

On further investigation,it seems like Weld has a special call that it
makes when a producer field is static but also annotated with a JavaEE
resource. Eventually that calls to JaxwsInjectionServices, a weld SPI that
we don't implement and falls back to just getting the value of the static
field, which may not be set.

We followed the Weld integration guide which said that we can handle JavaEE
resource injection either by implementing the SPI InjectionServices where
we can hook every injection call and to additional injection ourselves, or
by implementing EjbInjectionServices, JaxwsInjectionServices,
JpaInjectionServices and ResourceInjectionServices, all of which return a
factory which produces the instance that weld will then inject.

We implemented the former because it lets us just call our injectionengine,
but Weld doesn't seem to use this SPI at all when handling static producer
fields. Can someone confirm or give me some pointers how to fix this
problem?

-- 
Thanks
Emily
=================
Emily Jiang
ejiang at apache.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/weld-dev/attachments/20150514/615c908c/attachment.html 


More information about the weld-dev mailing list