获取spring里的bean

 

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

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

 

ClassPathXmlApplicationContext    可以用来读取xml文件

posted @   M号开发者  阅读(114)  评论(0编辑  收藏  举报
努力加载评论中...
点击右上角即可分享
微信分享提示