如何自定义Eova数据源?

OSSConfig.java 中添加自定义数据源代码

/**
	 * 自定义插件
	 */
	@Override
	protected void plugin(Plugins plugins) {
		// 数据源Key
		String datasource = "oss";
		
		// 添加数据源
		String ossUrl, ossUser, ossPwd;
		ossUrl = props.get("oss_url");
		ossUser = props.get("oss_user");
		ossPwd = props.get("oss_pwd");
		
		WallFilter wall = new WallFilter();
		wall.setDbType(JdbcUtils.MYSQL);
		
		DruidPlugin dp = new DruidPlugin(ossUrl, ossUser, ossPwd);
		dp.addFilter(new StatFilter());
		dp.addFilter(wall);
		
		ActiveRecordPlugin arp = new ActiveRecordPlugin(datasource, dp);
		// 方言
		arp.setDialect(new MysqlDialect());
		// 事务级别
		arp.setTransactionLevel(Connection.TRANSACTION_REPEATABLE_READ);
		// 统一全部默认小写
		arp.setContainerFactory(new CaseInsensitiveContainerFactory(true));
		// 是否显示SQL
		arp.setShowSql(true);
		System.out.println("load data source:" + ossUrl + "/" + ossUser);

		// arp.addMapping("xxx", Xxx.class);
		plugins.add(dp).add(arp);
		
		// 注册数据源
		dataSources.add(datasource);
		
		// 添加自动扫描插件
		
		// ...
	}


你可能感兴趣的:(如何自定义Eova数据源?)