Java Code Examples for com.jfinal.kit.PropKit#use()

The following examples show how to use com.jfinal.kit.PropKit#use() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JFinalTestApplication.java    From xDoc with MIT License 5 votes vote down vote up
@Override
public void configConstant(Constants constants) {
    constants.setJsonFactory(new JacksonFactory());
    constants.setDevMode(true);

    PropKit.use("application.txt");
}
 
Example 2
Source File: Test.java    From my_curd with Apache License 2.0 5 votes vote down vote up
static void init() {
    Prop jdbcProp = PropKit.use("config-dev.txt");
    DruidPlugin dp = new DruidPlugin(jdbcProp.get("oa.jdbc.url"),
            jdbcProp.get("oa.jdbc.user"), jdbcProp.get("oa.jdbc.password"), jdbcProp.get("oa.jdbc.driver"));
    dp.start();
    ActiveRecordPlugin arp = new ActiveRecordPlugin(ActivitiConfig.DATASOURCE_NAME, dp);
    arp.setDialect(new MysqlDialect());
    arp.setShowSql(true);
    arp.start();
    ActivitiPlugin ap = new ActivitiPlugin();
    ap.start();
}
 
Example 3
Source File: MysqlDataSourceUtils.java    From my_curd with Apache License 2.0 5 votes vote down vote up
/**
 * 获得数据库数据源,用于代码生成器
 *
 * @return 数据源
 */
public static DataSource getDataSource() {
    // 根据实际情况配置
    Prop configProp = PropKit.use("jdbc.properties");
    DruidPlugin dp = new DruidPlugin(configProp.get("jdbc.url"), configProp.get("jdbc.user"),
            configProp.get("jdbc.password"), configProp.get("jdbc.driver"));
    dp.start();
    return dp.getDataSource();
}
 
Example 4
Source File: JFinalCoreConfig.java    From xxl-job with GNU General Public License v3.0 5 votes vote down vote up
private void initXxlJobExecutor() {

		// registry jobhandler
		XxlJobExecutor.registJobHandler("demoJobHandler", new DemoJobHandler());
		XxlJobExecutor.registJobHandler("shardingJobHandler", new ShardingJobHandler());
		XxlJobExecutor.registJobHandler("httpJobHandler", new HttpJobHandler());
		XxlJobExecutor.registJobHandler("commandJobHandler", new CommandJobHandler());

		// load executor prop
		Prop xxlJobProp = PropKit.use("xxl-job-executor.properties");

		// init executor
		xxlJobExecutor = new XxlJobExecutor();
		xxlJobExecutor.setAdminAddresses(xxlJobProp.get("xxl.job.admin.addresses"));
		xxlJobExecutor.setAccessToken(xxlJobProp.get("xxl.job.accessToken"));
		xxlJobExecutor.setAddress(xxlJobProp.get("xxl.job.executor.address"));
		xxlJobExecutor.setAppname(xxlJobProp.get("xxl.job.executor.appname"));
		xxlJobExecutor.setIp(xxlJobProp.get("xxl.job.executor.ip"));
		xxlJobExecutor.setPort(xxlJobProp.getInt("xxl.job.executor.port"));

		xxlJobExecutor.setLogPath(xxlJobProp.get("xxl.job.executor.logpath"));
		xxlJobExecutor.setLogRetentionDays(xxlJobProp.getInt("xxl.job.executor.logretentiondays"));

		// start executor
		try {
			xxlJobExecutor.start();
		} catch (Exception e) {
			logger.error(e.getMessage(), e);
		}
	}
 
Example 5
Source File: WeixinConfig.java    From jfinal-weixin with Apache License 2.0 5 votes vote down vote up
/**
 * 如果生产环境配置文件存在,则优先加载该配置,否则加载开发环境配置文件
 * @param pro 生产环境配置文件
 * @param dev 开发环境配置文件
 */
public void loadProp(String pro, String dev) {
	try {
		PropKit.use(pro);
	}
	catch (Exception e) {
		PropKit.use(dev);
	}
}