Results 1 to 5 of 5

Thread: Will factory-bean attribute support in plan?

  1. #1
    Join Date
    Feb 2009
    Posts
    6

    Question 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 at 09:45 AM. Reason: gramma fix

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,625

    Default

    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..
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3
    Join Date
    Feb 2009
    Posts
    6

    Default

    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. #4
    Join Date
    Jan 2009
    Posts
    4

    Default

    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:
    http://jira.springframework.org/brow...IONSCRIPTAS-23

    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?

    Code:
    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 at 04:33 AM.

  5. #5
    Join Date
    Feb 2009
    Posts
    6

    Default

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •