public DruidPlugin createDruidPlugin() { Prop dbProp = PropKit.use("db.properties"); String db_host = dbProp.get("db_host").trim(); String db_name = dbProp.get("db_name").trim(); String db_user = dbProp.get("db_user").trim(); String db_password = dbProp.get("db_password").trim(); return DbDialectFactory.getDbDialect().createDuidPlugin(db_host, db_name, db_user, db_password); }
/** * 开发者模式判断 * * @author zyz */ public class DevConstants { private static final Prop prop = PropKit.use("run.properties"); public static final String RUN_MODE = prop.get("runMode", "release"); public static final String DB_CONFIG_FILENAME = RUN_MODE + "/" + prop.get("dbConfigFileName"); public static final String SYS_CONFIG_FILENAME = RUN_MODE + "/" + prop.get("sysConfigFileName"); /** 是否使用redis作数据库缓存 */ public static final boolean DB_CONFIG_USE_REDIS_CACHE = prop.getBoolean("dbConfigUseRedisCache", true); }
public class ServiceHolder { private static Prop pro = new Prop("config.properties"); public static RpcFactory rpcFactory = new RpcFactory(pro.get("busBrokers", "").split(",")); public static UserService userService = rpcFactory.getService(UserService.class, UserService.NAME); public static SubsService userSub = rpcFactory.getPubService(UserService.SUB_NAME); }