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

Object requires dependency getter for dependency satisfaction test

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: IoC container
    • Labels:
      None
    • Environment:
      SpringAS 2.0.1

      Description

      Assuming this is my config:

      <object id="myObject" class="com.test.MyObject">
      <property name="objectProperty">
      <dictionary id="securityMapping">
      ....
      </dictionary>
      </property>
      </object>

      public class MyObject implements IInitializingObject {
      private var _objectProperty:Dictionary;

      public function set objectProperty(value:Dictionary):void

      { _objectProperty = value; }

      public function afterPropertiesSet():void

      { ... }

      }

      In this case the afterPropertiesSet isn't called because according to SpringAS2 the objectProperty dependency hasn't been satisfied yet, so it skips DefaultDependencyInjector.initializeInstance(). More specifically because of this block of code in DefaultDependencyChecker.checkDependenciesSatisfied():

      var isNull:Boolean = true;
      try {
      if (!property.isStatic)

      { isNull = (instance[property.qName] == null); }

      else

      { isNull = ((objectDefinition.clazz)[property.qName] == null); }

      } catch (e:Error) {
      }

      because the field isn't static, it will try to access the property, but since it only has a setter it will return null. I've debugged the code and the objectProperty property has been injected, so it is not null.
      This was working in SpringAS1.

      I've attached a testcase with a unit test which tests this behavior. One test fails because the afterPropertiesSet hasn't been called by the context after initialization.
      You can execute the testcase by calling the "gradlew test" command in the root folder. Also make sure that you've set the FLEX_HOME environment variable to the location of your 4.x Flex SDK.

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Christophe Herreman
            Reporter:
            Yennick Trevels
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: