struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Musachy Barroso <>
Subject Re: Xwork injecting
Date Mon, 27 Jul 2009 21:01:29 GMT
you can't define 2 beans with the same type and the same name (in this
case empty by default). if you want to make it pluggable(that a word?)
 you first need to give it a name, like

<bean type="sometype" class="mytextprovider" name="mytextprovider" />

that will register the bean in the container (also give a default name
to the current provider, like "struts"). Now, that bean is not used,
because xwork is wired to use the default provider. So you need to add
a constant that will act like a "switch" for text provider

<constant name="struts.textProvider.class" value="mytextprovider" />

Then you register the bean in BeanSelectionProvider, like:

alias(TextProvider.class, "struts.textProvider.class", builder, props);

The ActionMapper is a perfect example of this, look at
struts-default.xml and BeanSelectionProvider.


On Mon, Jul 27, 2009 at 1:42 PM, Lukasz
Lenart<> wrote:
> Hi,
> I'm working on two bugs regarding injecting custom TextProvider into
> XWork classes. The default TextProvider is defined in
> XWorkConfigurationProvider class, but when I tried to define my own
> bean in a xml config file, I've got exception:
> Caused by: Bean type interface com.opensymphony.xwork2.TextProvider
> with the name system has already been loaded by [unknown location] -
> bean - file:/C:/java-projects/xwork-2-1-x-trunk/core/target/test-classes/com/opensymphony/xwork2/config/providers/xwork-test-text-provider.xml:8:137
>        at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(
> So, I removed the default TextProvider definition from
> XWorkConfigurationProvider class, update default xwork-default.xml
> file (which is mismatched in many places ;-) and so on. After few more
> changes only one test is falling: SpringObjectFactoryTest, but is it
> possible to override such definition and omit all that changes I made?
> Regards
> --
> Lukasz
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

"Hey you! Would you help me to carry the stone?" Pink Floyd

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message