SX Spring Actionscript
  1. SX Spring Actionscript
  2. SESPRINGACTIONSCRIPTAS-106

MXMLApplicationContext does not support factoryMethod and factoryObjectName properties.

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.0, 1.0RC1
    • Fix Version/s: None
    • Component/s: IoC container
    • Labels:
      None
    • Environment:
      Tested on Ubuntu Linux and Windows Xp against both spring-actionscript-core-1.0RC1 and spring-actionscript-core-1.0RC2-20100621.144359-17.

      Description

      Defining factoryMethod to create an object in a MXMLApplicationContext does not work - the object is always created via instantiation. Attached is an example of the bug. In this example the factory method returns the same type as the class it is defined in, and so the instantiation works. Were this not the case the cast would fail and the object would not get created.

      The following appears to be the issue:

      When loading the MXML contexts and creating an ObjectDefinition the MXMLApplicationContext fails to set the factoryMethod and factoryObjectName properties. This means that when the AbstractObjectFactory attempts to buildObject the test to see if factoryName (line 450 on trunk) has been defined always fails, and so the object will always be instantiated as opposed to being created via the factory method.
      The most immediate fix seems to be to add the followinf lines after line 426 of MXMLApplicationContext.

      result.factoryMethod = mxmlDefinition.factoryMethod;
      result.factoryObjectName = mxmlDefinition.factoryObjectName;

        Activity

        Hide
        Roland Zwaga added a comment -

        Fixed in the trunk

        Show
        Roland Zwaga added a comment - Fixed in the trunk

          People

          • Assignee:
            Roland Zwaga
            Reporter:
            Adam King
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 0.5h
              0.5h
              Remaining:
              Remaining Estimate - 0.5h
              0.5h
              Logged:
              Time Spent - Not Specified
              Not Specified