A prototype bean will have one instance created per place the bean is injected. When a prototype bean is injected as a Provider , each call to get() will create a new instance. |
When injecting a collection of beans, they will not be ordered by default. To allow for the beans to be ordered, implement the interface. If the requested bean type does not implement Ordered, then the annotation will be searched for on any beans.
The @Order annotation is especially useful for ordering beans created by factories where the bean type is a class in a third party library. In this example, both LowRateLimit
and HighRateLimit
implement the interface.
Factory with @Order
Factory with @Order
Factory with @Order