Blog.csdn.net/qq_33468007…

How does Autowire inject collections?

for example

public interface user{

}

@Component
public class user1 implements user{
}

@Component
public class user2 implements user{
}

@Component
public class user3 implements user{
}

@Component
public class Manage{
  
  @Autowire
  private List<User> users;
  
  public void setUsers(List<User> users){
       this.users=users;
  }
}
Copy the code