===== mvn依赖 ===== 20 a b c ===== main 函数 ===== public class App { public static void main( String[] args ) { BeanFactory factory = new ClassPathXmlApplicationContext("spring.xml"); IUser user = (IUser)factory.getBean("user"); user.showAge(); System.out.println(((ZhangSan)user).getList()); } } ===== Rule.java ===== package aa.bb; import java.util.List; /** * Created by fang on 16/9/26. */ public class ZhangSan implements IUser { private int age; private List list; public void showAge() { System.out.println("zhang san: "+age); } public void setAge(int age) { this.age = age; } public int getAge() { return age; } public void setList(List list) { this.list = list; } public List getList() { return list; } } {{:pasted:20160926-204142.png}}