How to load a bean defined without id or name?
Also how will spring differentiate if I have define 2 beans of same class without id or name
<bean class="xyz" />
<bean class="xyz" scope="prototype" />
it’s written that
Incase there are other bean using the same name, a unique name will be generated
How does spring handle this?
You can load beans by type:
The above will return a map from (generated) id to bean instance.
If you are autowiring by type, it will throw an exception (two beans of the same type). You cannot autowire by name as there is no name.