Matúš Sekáč opened SPR-17437 and commented
When I create two bean factory methods with the same name and different return type (and with qualifiers of course), the Application Context fails to start and the error message suggests that there is no bean of either type defined. This is misleading error message. It should either work (all information to distinguish beans is there), or fail with proper error message (Eg. ambiguous factory method definition).
See attached example project.
Affects: 5.0.10
Attachments: - spring-example.zip (73.62 kB)
Comment From: snicoll
Unfortunately, this does not create two beans but the context chooses the factory method that matches the state of the application context, in a similar fashion that the most suitable constructor is chosen if a target bean defines more than one.
This is confusing indeed and such arrangement is going to be deprecated.
Duplicate of #31073