获取spring里的bean

 

ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("spring.xml");

UserService userService = (UserService) applicationContext.getBean("userServiceImpl");

 

ClassPathXmlApplicationContext    可以用来读取xml文件

posted @ 2019-03-29 11:35  M号开发者  阅读(114)  评论(0编辑  收藏  举报