Hi Paul,
yesterday I started to write tests for the spring-integration (using
embedded jetty as you posted some weeks ago, which is really cool
btw :)).
When doing this I noticed, that WebApplication.initiate fails when
injectResources is invoked for XMLJAXBElementProvider (which inherits
the field
@Context private ContextResolver<JAXBContext> cr;
from AbstractJAXBElementProvider).
How is this realized, how can I test on this case? The issue is, that I
currently try to get an instance of a @Context annotated field, if
there's no type->injectable mapping existing for the field type.
Here's the stack trace:
java.lang.InstantiationException: javax.ws.rs.ext.ContextResolver
at java.lang.Class.newInstance0(Class.java:340)
at java.lang.Class.newInstance(Class.java:308)
at com.sun.ws.rest.impl.application.WebApplicationImpl$AdaptingComponentProvider.getInstance(WebApplicationImpl.java:280)
at com.sun.ws.rest.impl.application.WebApplicationImpl$3.getInjectableValue(WebApplicationImpl.java:251)
at com.sun.ws.rest.spi.resource.Injectable.inject(Injectable.java:58)
at com.sun.ws.rest.impl.application.WebApplicationImpl.injectResources(WebApplicationImpl.java:260)
at com.sun.ws.rest.impl.application.WebApplicationImpl.injectResources(WebApplicationImpl.java:218)
at com.sun.ws.rest.impl.application.WebApplicationImpl.access$300(WebApplicationImpl.java:99)
at com.sun.ws.rest.impl.application.WebApplicationImpl$AdaptingComponentProvider.getInstance(WebApplicationImpl.java:281)
at com.sun.ws.rest.impl.application.ComponentProviderCache.getComponent(ComponentProviderCache.java:89)
at com.sun.ws.rest.impl.application.MessageBodyFactory.getProviderMap(MessageBodyFactory.java:106)
at com.sun.ws.rest.impl.application.MessageBodyFactory.<init>(MessageBodyFactory.java:81)
at com.sun.ws.rest.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:411)
Another possibility would be to use the annotation->injectable thing for
this, another would be to use another annotation than @Context.
What do you think?
Cheers,
Martin