直接获取spring bean

来源:互联网 发布:矩阵命名变量 编辑:程序博客网 时间:2024/05/22 04:53
ApplicationContext applicationContext = new ClassPathXmlApplicationContext(new String[] { "applicationContext-dao.xml","applicationContext-action.xml"});//获取配置文件
SocketPackageService socketPackageService = (SocketPackageService) applicationContext.getBean("socketPackageService");//获取bean
0 0
原创粉丝点击