Results 1 to 2 of 2

Thread: Creating new instances of beans.

  1. #1
    Join Date
    May 2011
    Posts
    1

    Default Creating new instances of beans.

    Hello,

    How can I create multiple instances of a bean?

    I'm trying to make a loop that will make a new instance of a the same bean and set attributes of that bean.

    -Mike

  2. #2

    Default

    Hi,

    You can set the beans' scope to "prototype" and that will make Spring create a new instance of them whenever they are requested (via injection or ApplicationContext.getBean() method).
    Gabriel Axel
    Sparklix | Blog | Twitter | Github

Tags for this Thread

Posting Permissions

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