Spring calls the method of the service interface. Which method of the implementation class will be called by multiple implementation classes without specifying the Qualifier annotation?

in the case of multiple implementation classes for an interface, the Qualifier annotation is not specified. Which implementation class method will be called?


is related to the spring version. If it is the default behavior of Autowired, Spring 5, an error will be reported

nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type xxx is defined: yyy expected single matching bean but found 2: zzz

if there are multiple implementation classes, you can use which one can be scanned. If multiple classes are scanned and there is no Qualifier, you will definitely report an error

.
Menu