Instantiating multiple beans of the same class with Spring annotations

Posted by Francois on Stack Overflow See other posts from Stack Overflow or by Francois
Published on 2010-05-25T05:55:51Z Indexed on 2010/05/25 6:01 UTC
Read the original article Hit count: 341

Filed under:
|

With an XML configured Spring bean factory, I can easily instantiate multiple instances of the same class with different parameters. How can I do the same with annotations? I would like something like this:

@Component(firstName=”joe”, lastName=”smith)
@Component(firstName=”mary”, lastName=”Williams”)
public class Person { /* blah blah */ }

© Stack Overflow or respective owner

Related posts about spring

Related posts about annotations