Spring Boot - Inversion of Control and Dependency Injection
Given the code below, what will be printed when
useService() is called?@Component("serviceA")
class ServiceA implements Service { public String getName() { return "A"; } }
@Component("serviceB")
class ServiceB implements Service { public String getName() { return "B"; } }
@Autowired
@Qualifier("serviceB")
private Service service;
public void useService() {
System.out.println(service.getName());
}