Announcement Announcement Module
No announcement yet.
Will factory-bean attribute support in plan? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Will factory-bean attribute support in plan?

    Hi, just a quick search in the xml schema.

    doesn't seems to find a defination for something like factory-bean. which means we can not use a factoryBean to generate instace.

    the factory-method attribute then seems can only work on the class itself as an signleton implemenation then?

    am I right about this?
    or will this factory-bean thing be supported later?
    Last edited by n0rthwood; Feb 12th, 2009, 09:45 AM. Reason: gramma fix

  • #2
    I suggest you read the reference guide instead of the xml schema, it gives you much more information. You can use the factory-method also for non-singletons it just depends on the scope you give your bean..


    • #3
      sorry , the singleton thing i said about factory-method might be a bit mis-leading.
      I do know that i can define prototye or singleton for my bean, that is how the spring actionscript framework manages singletons. (to generate new object or return the same one on each getBean() invocation)

      but what I meat is the factory-method can not be used on another objectInstance(factory-bean) to retrieve an instance, it only work on itself which is restricted to be a static method.

      The factory-bean attribute is supported in the java spring framework, that is why i am asking about it.


      • #4
        Hey n0rthwood,

        Thank you for your response to my 'multiple applications contexts' post. I understand the problem that you are have, using factory-method the method that you are calling has to be static on the providing bean.
        I'm not too hot on the Spring-java, are you saying that by using factory-bean you can specify an instance of a bean to call the method on, and therefore the method can be public?
        I've logged a a similar feature request in the jira for this project:

        It includes a current workaround that I am using to get properties of instantiated beans, maybe you could add another static method to the util for calling a method such as?

        public static function callMethodOfInstance(instance : Object, method : String, ...args) : *
           return ( instance[ method ] as Function ).apply( instance , args );
        Check it out and let me know what you think
        Last edited by enzuguri; Feb 13th, 2009, 04:33 AM.


        • #5
          I think the factory-bean combine with factory-method allows you to get a result of a method.

          the contructor-arg you provided now will be served as the args for this factory-method on this certain factorybean.

          this is how java implement it,actually, this is very practical sometimes, because you might want to get an instance from another instance instead of create it as a brand new instance.

          and I think if spring actionscript support this factory-bean as java spring does, it will solve your problekm in SESPRINGACTIONSCRIPTAS-23