1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | // Method used for retrieving spring xml public static Object getDataByBeanId(String clazzName, String action, String key) throws Exception { String dataFile = null; Object response = null; // check if service is "enabled" if ((ACCOUNT_SEARCH_ENABLED_KEY != null) && (ACCOUNT_SEARCH_ENABLED_KEY != "") && (ACCOUNT_SEARCH_ENABLED_KEY.equalsIgnoreCase("FALSE"))) { throw new Exception("service is disabled"); } dataFile = getFile(action, key); com.simulator.SpringContext stsc = new com.simulator.SpringContext ( dataFile); org.springframework.beans.factory.BeanFactory bf = stsc .getBeanFactory(); // retrieve pojo response = bf.getBean(clazzName); // check i latency has been injected if ((ACCOUNT_SEARCH_LATENCY_KEY != NULL) && (ACCOUNT_SEARCH_LATENCY_KEY.length() != 0)) { sleep(ACCOUNT_SEARCH_LATENCY_KEY; } return response; |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |