You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Daniel Uribe (JIRA)" <ji...@apache.org> on 2007/04/04 20:00:58 UTC

[jira] Commented: (WW-1754) The current struts-default.xml prevents TypeConverter wiring

    [ https://issues.apache.org/struts/browse/WW-1754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_40753 ] 

Daniel Uribe commented on WW-1754:
----------------------------------

I had a Struts 2.0.6 installation with the simple patch described above, which just inverted the converter and the object factory, but I still have some problems during the conversion when the list of defaultMappings only includes the converters that were not wired through Spring. 

This happened when converting the value of the key from a Map into the appropriate object. The XWorkMapPropertyAccessor can correctly find the class to convert to, but when it calls the XWorkConverter to convert the value, the lookup(toClass) in line 302 fails to convert since the defaultMappings property doesn't contain any of the Spring wired converters. It would seem to me as if maybe the converter that was wired into the property accessor was wired before the correct XWorkConverter (with the custom object factory) was instantiated.

I tried moving:

<bean class="com.opensymphony.xwork2.ObjectFactory" static="true" />

to the beginning of the statics, even before the OgnlValueStack is wired and it seemed to fix this problem. It leads me to believe that the static injection for the OgnlValueStack sets other instances of the converter that were instantiated before the com.opensymphony.xwork2.util.XWorkConverter statics were injected.

> The current struts-default.xml prevents TypeConverter wiring
> ------------------------------------------------------------
>
>                 Key: WW-1754
>                 URL: https://issues.apache.org/struts/browse/WW-1754
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Configuration
>    Affects Versions: 2.0.6
>         Environment: struts 2.0.6, xwork 2.0.1, spring-plugin 2.0.5
>            Reporter: Nicolas Berthet
>            Priority: Minor
>             Fix For: 2.0.7, 2.1.0
>
>
> Due to the apparition order in struts-default, the XWorkConverter is created before the container and this prevent any auto-wiring at converter's level.
> Current order (struts-default.xml, line 46-47)
>     <bean class="com.opensymphony.xwork2.util.XWorkConverter" static="true" />
>     <bean class="com.opensymphony.xwork2.ObjectFactory" static="true" />
> It should be in that order 
>     <bean class="com.opensymphony.xwork2.ObjectFactory" static="true" />
>     <bean class="com.opensymphony.xwork2.util.XWorkConverter" static="true" />

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.