springconfig.java
来自「springGather 在JAVA环境开发的电信运营支持系统」· Java 代码 · 共 53 行
JAVA
53 行
package org.com.gather;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.InputStreamResource;
import java.io.*;
import java.util.*;
public class SpringConfig implements Config{
private Properties pro = null;
private BeanFactory factory = null;
public SpringConfig(Properties pro){
this.pro = pro;
this.init();
}
public void init(){
try{
InputStream is = new FileInputStream(pro.getProperty("beanFactory.xml"));
InputStreamResource ir = new InputStreamResource(is);
factory = new XmlBeanFactory(ir);
}catch(Exception e){
e.printStackTrace();
}
}
public Gather getGather(){
return (Gather)factory.getBean("gather");
}
public DB getDB(){
return (DB)factory.getBean("db");
}
public Log getLog(){
return (Log)factory.getBean("log");
}
public BackUp getBackUp(){
return (BackUp)factory.getBean("backup");
}
public Client getClient(){
return (Client)factory.getBean("client");
}
public Server getServer(){
return (Server)factory.getBean("server");
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?