cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Beryozkin" <>
Subject Re: Injecting the configuration programmatically
Date Fri, 15 Dec 2006 12:54:21 GMT

3rd option seems the simpliest one, as I need to inject properties for a known bean only...

"For example to avoid getting tangled up in the Spring logic, you could just extend the 

How to register a custom implementation with the bus ?

Thanks, Sergey

Well if you just want to specify a particular configuration file programmatically, then the
simplest way is to use the 
SpringBusFactory.createBus(String cfgFile) API.

If you want to *completely* replace the Spring Configurer with your own implementation, then

   Bus.setExtension(Configurer.class, myConfigurer);

If you want to *selectively* inject property values for some particular beans (but let the
other beans pick up their property values 
from the config file as usual), then I think there's some work to do. I'm no Spring expert,
and Andrea would be really be person to 
comment definitively on this. However seeing as she's on vacation, I'd guess you could try
down-casting the Configurer bus extension 
to an org.springframework.beans.factory.wiring.BeanConfigurerSupport, then call setBeanFactory()
on this to set your own fa├žade 
implementation of org.springframework.beans.factory.config.AutowireCapableBeanFactory. Then
in autowireBeanProperties() and 
applyBeanPropertyValues(), check if the bean being configured is the one you want to selectively
inject specific property values 
into. If so, go ahead and do this. If not, delegate to the original bean factory.

There may well be a simpler and better way of doing this. For example to avoid getting tangled
up in the Spring logic, you could 
just extend the org.apache.cxf.configuartion.spring.ConfigurerImpl to allow values for specific
beans to be injected into say a 
local map, which is then checked before configureBean() delegates to the super-class implementation

As always, I'm open to correction by the Spring aficionados.


> -----Original Message-----
> From: Sergey Beryozkin []
> Sent: 14 December 2006 09:35
> To:
> Subject: Injecting the configuration programmatically
> Hi
> Is there any way to inject the configuration into the CXF
> runtime programmatically ?
> For ex, one way is to tell the runtime where the config is by
> pointing it to the cxf.xml (default name...). Is there any
> way to create a required configuration and tell the runtime
> that the configuration for a given bean name is available ?
> Thanks, Sergey

View raw message