启动Spring
xml方式生成bean
ClassPathXmlApplicationContext applicationContext=new ClassPathXmlApplicationContext(spring.xml);
注解方式生成bean
AnnotationConfigApplicationContext applicationContext=new AnnotationConfigApplicationContext(AppConfig.class);
getBean
userService userService=applicationContext.getBean("userServcie",userService.class);