Multiple Instances Of Spring Managed Component


Please suggest what is the best way to deal with this situation,
I have Spring managed MainComponent what I can Autowire wherever I need, the MainComponent needs to have multiple instances of ItemDetailComponent which I also want to be Spring managed so I do not have to worry about any required dependancies and let the Spring manage it,
How can I achieve this?
Please see the attached screenshot to understand my question better

Thanks for any suggestions,


@Scope(“prototype”) for ItemDetailComponent class

Does that mean everytime I refer the Autowired instance of ItemDetailComponent inside a loop to populate with each item specific data I will get a new instance of the ItemDetailComponent?
I need multiple instances of ItemDetailComponent within same component.

Autowired correction in example screenshot

It creates a new bean instance every time a request for that specific bean is made (that is, it is injected into another bean or it is requested via a programmatic getBean() method call on the container).