Thanks for the quick answer.
I've added the following to my spring configuration:

<bean class="org.apache.cxf.jaxb.JAXBDataBinding" >
    <constructor-arg index="0" value="#{GlobalContextBean.context}"/>
</bean>

And the start-up time of the application / memory was significantly changed 
(for good).
Am I supposed to add something more or this should be enough?
How should I configure the CXF endpoints to use it? (although it looks like 
they already did)
Thanks in advance,
  Avner

-----Original Message-----
From: Daniel Kulp [mailto:[email protected]] 
Sent: Tuesday, October 02, 2012 11:02 PM
To: [email protected]
Subject: Re: Reuse JAXB context in jaxws


On Oct 2, 2012, at 8:16 AM, Avner Levy <[email protected]> wrote:
> Hi,
> I have multiple services which can return results out of thousands of 
> classes. 
> Since each CXF service contains a private otherwise-identical JAXB context, 
> it causes a huge memory waste. 
> Is there a way to create the JAXB context myself and share it between the 
> services?
> Thanks in advance,
> Avner

The JAXBDataBinding does have a constructor that takes a JAXBContext.   Thus, 
you could create the JAXBDataBinding object yourself with the JAXBContext you 
need, then configure that into the CXF endpoints.   There is a 
<jaxws:dataBinding> child element for the <jaxws:endpoint> if you are using 
that to setup the services.

That said, I HIGHLY doubt this is well tested.  You'd be in more or less 
uncharted territory.  :-)

--
Daniel Kulp
[email protected] - http://dankulp.com/blog Talend Community Coder - 
http://coders.talend.com


Scanned by Check Point Total Security Gateway.

Reply via email to