cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Chen <alex.c...@iona.com>
Subject Re: Injecting the configuration programmatically
Date Fri, 15 Dec 2006 02:05:44 GMT
Hi Eoghan,

I have a task to use CXF inside Eclipse plugin, so I wonder what's the 
minimum configuration arguments for initializing CXF bus properly?

If I use SpringBusFactory.createBus(String cfgFile) and supply the 
default cxf.xml find in cxf-rt-core-2.0-incubator-M1-SNAPSHOT.jar, does 
that enough?

thanks,
--Alex


Glynn, Eoghan wrote:
> 
> 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 use:
> 
>    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 [i.e. org.springframework.beans.factory.wiring.BeanConfigurerSupport.configureBean()].
> 
> As always, I'm open to correction by the Spring aficionados.
> 
> Cheers,
> Eoghan
> 
> 
>> -----Original Message-----
>> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com] 
>> Sent: 14 December 2006 09:35
>> To: cxf-dev@incubator.apache.org
>> 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 
>>
>>
> 

Mime
View raw message