📄 springconfig.java
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -