You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "Kessel, Christopher" <ck...@transunion.com> on 2009/11/03 18:27:04 UTC

CXF, don't want it to init lazy Spring beans at startup

As a noob to CXF, I'll apologize first if this has been asked. I looked
in the CXF manual, particular the FAQ, and did a quick search on Stack
Overflow and didn't find anything definitive.  Google seems to hint I'm
screwed, but it's hard to tell for sure.

 

The problem: 

Our Spring files defined a number of services as "lazy-init=true".
Essentially, we have lazy beans that only get inited in certain
execution contexts, such as mock services that would only end up being
used in a dev environment.  We have similar cases with both client and
server beans defined in the same spring file, but only one or the other
ends up instantiated depending on whether it's the client or server
running. In fact, the classpath may not even hold the client class in
the classpath if it's the server instance being started.

 

What I'm running into with CXF is the
org.apache.cxf.resource.ResourceManager is causing all the lazy beans to
init, or at least trying to resolve them, and throwing errors since many
of them aren't supposed to run in that particular instance (e.g. lazy
client beans being inited in the server instance).

 

Is there a way to tell CXF to not look at the lazy beans or define some
sort of exclude list? Otherwise I'm looking at a huge refactor of our
Spring files  L. 

 

Thanks,

Chris

 


Re: CXF, don't want it to init lazy Spring beans at startup

Posted by Daniel Kulp <dk...@apache.org>.
What version of CXF?   I know some fixes in this area were added to CXF 2.2.4.

Can you provide a small test case?

Dan



On Tue November 3 2009 12:27:04 pm Kessel, Christopher wrote:
> As a noob to CXF, I'll apologize first if this has been asked. I looked
> in the CXF manual, particular the FAQ, and did a quick search on Stack
> Overflow and didn't find anything definitive.  Google seems to hint I'm
> screwed, but it's hard to tell for sure.
> 
> 
> 
> The problem:
> 
> Our Spring files defined a number of services as "lazy-init=true".
> Essentially, we have lazy beans that only get inited in certain
> execution contexts, such as mock services that would only end up being
> used in a dev environment.  We have similar cases with both client and
> server beans defined in the same spring file, but only one or the other
> ends up instantiated depending on whether it's the client or server
> running. In fact, the classpath may not even hold the client class in
> the classpath if it's the server instance being started.
> 
> 
> 
> What I'm running into with CXF is the
> org.apache.cxf.resource.ResourceManager is causing all the lazy beans to
> init, or at least trying to resolve them, and throwing errors since many
> of them aren't supposed to run in that particular instance (e.g. lazy
> client beans being inited in the server instance).
> 
> 
> 
> Is there a way to tell CXF to not look at the lazy beans or define some
> sort of exclude list? Otherwise I'm looking at a huge refactor of our
> Spring files  L.
> 
> 
> 
> Thanks,
> 
> Chris
> 

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog