/**
* 此類用于讀取XXX Project 中的配置信息
* @author zzz
*
*/
@Name("XxxPropertiesFactory")
@Scope(ScopeType.APPLICATION)
public class XxxProperties {
private static Properties prop;
static{
synchronized(XxxProperties.class){
prop= new Properties();
InputStream is = XxxProperties.class.getResourceAsStream("/xxx.properties");
if(is == null){
throw new RuntimeException("can not found the file xxx.properties");
}
try {
prop.load(is);
is.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
@Factory(value="xxxProperties",autoCreate=true,scope=ScopeType.APPLICATION)
public Properties getXxxProperties(){
return prop;
}
public static XxxProperties instance(){
return (XxxProperties) Component.getInstance(XxxProperties.class,ScopeType.APPLICATION);
}
}
Properties properties = XxxProperties.instance().getXxxProperties(); initFirstResult = Integer.valueOf(properties.getProperty("xxx.employee.page.size"));