main获得Spring配置文件中的bean

来源:互联网 发布:linux 查看内存使用率 编辑:程序博客网 时间:2024/06/17 19:51
Resource resource = new ClassPathResource("../applicationContext.xml");BeanFactory factory = new XmlBeanFactory(resource);interceptionNeedInfo = (IInterceptionNeedInfo)factory.getBean("interceptionNeedInfo");ICodetypeAction codetype = (ICodetypeAction)factory.getBean("codetypeAction");List<Map<String, String>> codeTypeList = codetype.getCodeType();return codeTypeList;

原创粉丝点击