Doc: @Configuration class accepts overloaded factory methods for same bean [SPR-13438] #18018
I do not expect a single
Here is a test demonstrating the behavior. I guess there is no know knowing which bean has been accepted, and this would change from one environment to another.
Referenced from: commits 93f77f5
Juergen Hoeller commented
While this isn't properly documented, it is a supported feature - but not for defining multiple beans of the same name, rather just for providing various factory methods for the same bean. This is then the same algorithm as for choosing the "greediest" constructor or factory method in other configuration scenarios: Depending on the available dependencies, the variant with the largest number of satisfiable dependencies is being picked.
Compare a component class where several constructors are marked with
Turning this issue into a documentation task, since this needs to be better documented.