Announcement Announcement Module
Collapse
No announcement yet.
Creating new instances of beans. Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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).

    Comment

    Working...
    X