JEECG系统配置文件位于:
main/resousres/sysConfig.properties文件
那么在什么地方用到呢:
- main/java/org.jeecgframework.core.util/jeecgSqlUtil.java
代码:
private static final ResourceBundle bundle = java.util.ResourceBundle.getBundle("sysConfig");
public static String getMethodSql(String methodUrl) {
//[1].开发模式:dev SQL文件每次都加载
if(ConstantsDefs.MODE_DEVELOP.equals(bundle.getObject("sqlReadMode"))){
return getMethodSqlLogicJar(methodUrl);
}
//[2].发布模式:pub SQL文件只加载一次
else if(ConstantsDefs.MODE_PUBLISH.equals(bundle.getObject("sqlReadMode"))){
Element element = dictCache.get(methodUrl);
if (element == null) {
element = new Element(methodUrl, (Serializable) getMethodSqlLogicJar(methodUrl));
//永久缓存
dictCache.put(element);
}
return element.getValue().toString();
}
else{
return "";
}
}
- main/java/org/jeecgframework/core/util/PropertiesUtil.java
public static void main(String[] args) {
PropertiesUtil p = new PropertiesUtil("sysConfig.properties");
p.writeProperty("namess", "wang");
org.jeecgframework.core.util.LogUtil.info(p.readProperty("namess"));
}
- main/java/org/jeecgframework/core/util/ResourceUtil.java
private static final ResourceBundle bundle = java.util.ResourceBundle.getBundle("sysConfig");
/**
* 获取数据库类型
*
* @return
* @throws Exception
*/
public static final String getJdbcUrl() {
return DBTypeUtil.getDBType().toLowerCase();
}
// update-begin--Author:zhangguoming Date:20140226 for:添加验证码
/**
* 获取随机码的长度
*
* @return 随机码的长度
*/
public static String getRandCodeLength() {
return bundle.getString("randCodeLength");
}