Its sort of a bug.

ContextResolver wasn't supposed to be used in the way your example was 
written, it really was supposed to be used in conjunction with the 
Providers interface:

    @Context
    protected Providers providers;


    public JAXBContext findProvidedJAXBContext(Class<?> type, MediaType 
mediaType)
            throws JAXBException
    {
       JAXBContext jaxb = null;
       ContextResolver<JAXBContext> resolver = 
providers.getContextResolver(JAXBContext.class, mediaType);
       if (resolver != null)
       {
          jaxb = resolver.getContext(type);
          if (jaxb != null) return jaxb;
       }
       return jaxb;
    }

The above is taken from our MessageBodyReader/Writer support for JAXB. 
It allows people to personally configure JAXB for a specific media type 
and for a specific java type.

IMO, you should be using it in this way, or instead, use CDI, Spring, 
Guice, EJB or whatever for your dependenncy injection.


On 8/30/2012 6:28 AM, Duncan Bloem wrote:
> Hi,
>
> I have made a very simple pure JAX-RS demo application.
> You can find it here: https://github.com/dabloem/jaxrs
>
> When deployed to JBoss As 7.1.0, the application does not inject
> MyResolver into field @Context ContextResolver<MyObject> within
> GenericResource. It is always null.
>
> When deployed to GF3.1.2, injections works fine.
>
> It looks like I am missing something to register the ContextResolver in
> RestEasy, but I could  not find any documentation or example.
>
> Any suggestions are welcome, thanks.
>
> Duncan
>
>
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>
>
>
> _______________________________________________
> Resteasy-users mailing list
> Resteasy-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/resteasy-users
>

-- 
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Resteasy-users mailing list
Resteasy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/resteasy-users

Reply via email to