If there are multiple beans that match the criteria of injecting a dependency then Spring will through an error. It won't pick one on its own. There are several ways of defining criteria like using specific type instead of a generalized one or using @Qualifier
or @Primary
etc. but if no preference can be calculated based on all the available criteria then this is broken configuration and must be fixed.