The class com.opensymphony.xwork2.config.providers.XmlConfigurationProvider
in method register(...) use this logic for checking....

if (containerBuilder.contains(ctype, name)) {
     Location loc =
LocationUtils.getLocation(loadedBeans.get(ctype.getName() + name));
            if (throwExceptionOnDuplicateBeans) {
                  throw new ConfigurationException("Bean type " + ctype + "
with the name " +
                        name + " has already been loaded by " + loc, child);
            } 
     }
Thus I CAN NOT register 2 bean with same type and name!!!

I can register new TextProvider with defferent name:xxxstruts . But I am not
sure that exactly my bean will be used to create an object for TextProvider.

At that time there is a bug in XWork 2.0.1....2.1.0  when TextProvider
object is created.

I want to investigate the common method for loading my realization of
standart bean.











cilquirm wrote:
> 
> I think the problem might be that there may not be a way to configure a
> different TextProvider.
> 
> Consider the object factory example, in this case guice :
> 
> <struts>
> 
>   <bean type="com.opensymphony.xwork2.ObjectFactory" 
>         name="guice"
>         class="com.google.inject.struts2.GuiceObjectFactory"/>
> 
>   <!--  Make the Guice object factory the automatic default -->
>   <constant name="struts.objectFactory" value="guice" />
> 
> </struts>
> 
> 
> What this does is create a bean provider with a given name of that type.  
> 
> The constant portion is actually the configuration piece.
> 
> I tried looking in the source, but I couldn't find how to configure the
> textProvider.  
> The two pre-configured ones both use the same class so one wouldn't note
> any difference.
> 
> Maybe someone on the list can help you out more.
> 
> Apologies,
> -a
> 
> 
> 
> Igor Vlasov wrote:
>> 
>> This action cause an error.
>> I will write in struts.xml:
>> &lt;struts>
>>   
>>   &lt;constant name="struts.enable.DynamicMethodInvocation" value="false"
>> />
>>   
>>   &lt;bean type="com.opensymphony.xwork2.TextProvider" name="xwork1"
>> class="karakas.struts.RicoTextProvider" />
>>   &lt;bean type="com.opensymphony.xwork2.TextProvider" name="struts"
>> class="karakas.struts.RicoTextProvider" />
>>   &lt;!-- Add packages here -->
>>   .....
>> &lt;/struts>
>> 
>> and use the same type(com.opensymphony.xwork2.TextProvider) and the same
>> name(struts) as in struts-defailt.xml 
>>  Then i recieve an error in tomcat log: 
>> 
>> 
>> Unable to load bean: type:com.opensymphony.xwork2.TextProvider
>> class:karakas.struts.RicoTextProvider - bean -
>> /web/WEB-INF/classes/struts.xml:10:109
>> 
>> Caused by: Bean type interface com.opensymphony.xwork2.TextProvider with
>> the name xwork1 has already been loaded by [unknown location] - bean -
>> file:/D:/projects/Karakas1.1/build/web/WEB-INF/classes/struts.xml:10:109
>> 
>> 
>> 
>> 
>> cilquirm wrote:
>>> 
>>> you can redefine it in your struts.xml, much like how you would specify
>>> the object factory to override the default object factory .
>>> 
>>> -a
>>> 
>>> 
>>> 
>>> Igor Vlasov wrote:
>>>> 
>>>> Hello.
>>>> I want to change some information in struts-default.xml.
>>>> 
>>>> I can move it to classes directoty and do any change....:-)
>>>> 
>>>> Is there any more sofisticated method to do the same from struts.xml?
>>>> 
>>>> For example i want to change TextProvider:
>>>> From 
>>>>    <bean type="com.opensymphony.xwork2.TextProvider" name="struts"
>>>> class="one class" />
>>>> 
>>>> to    
>>>> <bean type="com.opensymphony.xwork2.TextProvider" name="struts"
>>>> class="another class" />
>>>> 
>>> 
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-S2---Change-struts-default.xml-content-tf4684048.html#a13420988
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to