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 implementations: <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. musachy On Mon, Jul 27, 2009 at 1:42 PM, Lukasz Lenart<lukasz.len...@googlemail.com> 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(XmlConfigurationProvider.java:205) > > 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 > http://www.lenart.org.pl/ > http://dailylog.lenart.org.pl/ > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@struts.apache.org > For additional commands, e-mail: dev-h...@struts.apache.org > > -- "Hey you! Would you help me to carry the stone?" Pink Floyd --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@struts.apache.org For additional commands, e-mail: dev-h...@struts.apache.org