Announcement Announcement Module
Collapse
No announcement yet.
programatically get multiple beans Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • programatically get multiple beans

    Hi all,
    I am currently using a singleton component, which depends on a Set<Child> components like so:

    Code:
    @Component
    class MyComp {
    
       @Autowired
       public void setChildren(Set<Child> children) {
          this.children = children;
       }
    
    }
    There are many Child-derived classes (About 20), and I am letting spring bring all of them automatically at the moment.

    However, I am considering making all Child classes non-singletons. According to:
    http://static.springsource.org/sprin...thod-injection
    I am supposed to call beanFactory.getBean for each any every one of the Child-derived classes... Is there a better way to do it, so I don't need to explicitly reference Child-derived classes in the MyComp class?

    thanks.
Working...
X