Java Code Examples for com.jfinal.plugin.activerecord.DbKit#getConfig()
The following examples show how to use
com.jfinal.plugin.activerecord.DbKit#getConfig() .
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: JFinalTxAop.java From sdb-mall with Apache License 2.0 | 6 votes |
/** * 获取配置的TxConfig,可注解到class或者方法上 * @param pjp * @return Config */ public static Config getConfigWithTxConfig(ProceedingJoinPoint pjp) { MethodSignature ms = (MethodSignature) pjp.getSignature(); Method method = ms.getMethod(); TxConfig txConfig = method.getAnnotation(TxConfig.class); if (txConfig == null) txConfig = pjp.getTarget().getClass().getAnnotation(TxConfig.class); if (txConfig != null) { Config config = DbKit.getConfig(txConfig.value()); if (config == null) throw new RuntimeException("Config not found with TxConfig: " + txConfig.value()); return config; } return null; }
Example 2
Source File: InstallController.java From jpress with GNU Lesser General Public License v3.0 | 6 votes |
private void initActiveRecordPlugin() { DataSourceConfig config = InstallManager.me().getDataSourceConfig(); // 在只有 jboot.properties 但是没有 install.lock 的情况下 // jboot 启动的时候会出初始化 jboot.properties 里配置的插件 // 此时,会出现 config already exist 的异常 if (DbKit.getConfig(DataSourceConfig.NAME_DEFAULT) == null) { config.setName(DataSourceConfig.NAME_DEFAULT); } else { config.setName(StrUtil.uuid()); } DataSourceConfigManager.me().addConfig(config); ActiveRecordPlugin arPlugin = ArpManager.me().createRecordPlugin(config); arPlugin.start(); }
Example 3
Source File: JfinalHelper.java From snakerflow with Apache License 2.0 | 5 votes |
public static Config getConfig() { if(config == null) { synchronized (JfinalHelper.class) { if(config == null) { if(StringHelper.isNotEmpty(configName)) { config = DbKit.getConfig(configName); } if(config == null) { config = DbKit.getConfig(); } } } } return config; }