Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » MOXy, XmlAdapter, and @Inject(Possible to @Inject or provide instance of XmlAdapter to MOXy?)
icon5.gif  MOXy, XmlAdapter, and @Inject [message #1214064] Wed, 27 November 2013 14:22 Go to next message
Eric Miles is currently offline Eric MilesFriend
Messages: 1
Registered: November 2013
Junior Member
I'm doing a short spike to determine if we can move our JAX-RS 2.0 application from using Jackson to MOXy. We use some Spring managed beans for customer serializers/deserializers for Jackson and naturally, would like to turn these into XmlAdapters. However, we have a need to @Inject some things into these adapters (which we are doing via some extension points in Jackson). I'm assuming this isn't supported by JAXB so I was hoping there was a way to do it via MOXy, however I can find nothing on it.

Is this possible? Is there a way to @Inject into an XmlAdapter or is there a way to provide an already instantiated XmlAdapter to MOXy for use rather than it "newing up" an instance upon first use?
Re: MOXy, XmlAdapter, and @Inject [message #1219921 is a reply to message #1214064] Fri, 06 December 2013 18:45 Go to previous message
Blaise Doughan is currently offline Blaise DoughanFriend
Messages: 163
Registered: July 2009
Senior Member

You can provide a configured instance of an XmlAdapter to MOXy or any JAXB implementation by calling setAdapter(XmlAdapter) on Marshaller/Unmarshaller. Below is a link to an example that should help.

To integrate this into JAX-RS you will need to leverage it through a MessageBodyReader/MessageBodyWriter.

Previous Topic:Retrieve joined element using criteria api
Next Topic:MOXy Performance and Caching
Goto Forum:

Current Time: Tue Apr 07 05:03:27 GMT 2020

Powered by FUDForum. Page generated in 0.01933 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top