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

2015-05-15 Thread Martin Kouba
Hi Emily,

for a static producer field there is no InjectionTarget (there's no 
instance to inject) and therefore no IT may be registered via 
InjectionServices.

When using InjectionServices the current API does not allow to bypass 
the value of the static field and obtain the EE resource (e.g. do a JNDI 
lookup). So we let the integrator inject the static field, then read 
the value and propagate as the bean instance.

Martin


Dne 14.5.2015 v 23:47 Emily Jiang napsal(a):

 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
 eji...@apache.org mailto:eji...@apache.org


 ___
 weld-dev mailing list
 weld-dev@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/weld-dev

___
weld-dev mailing list
weld-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/weld-dev


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

2015-05-14 Thread Emily Jiang
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
eji...@apache.org
___
weld-dev mailing list
weld-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/weld-dev