AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(AppConfig.class);
UserService userService = (UserService) applicationContext.getBean("com.zhouyu.service.UserService");
userService.test();
为什么bean的名字是这个呢?com.zhouyu.service.UserService
这样才能取到对应的bean,进行方法执行!
原因:todo