use of com.alibaba.druid.wall.WallFilter in project my_curd by qinyou.
the class AppConfig method configPlugin.
@Override
public void configPlugin(Plugins me) {
DruidPlugin dbPlugin = new DruidPlugin(PropKit.get("jdbcUrl"), PropKit.get("user"), PropKit.get("password"));
// druid 监控
dbPlugin.addFilter(new StatFilter());
WallFilter wall = new WallFilter();
wall.setDbType("mysql");
dbPlugin.addFilter(wall);
ActiveRecordPlugin arp = new ActiveRecordPlugin(dbPlugin);
arp.setShowSql(PropKit.getBoolean("devMode"));
arp.setDialect(new MysqlDialect());
MappingKit.mapping(arp);
me.add(dbPlugin);
me.add(arp);
}
use of com.alibaba.druid.wall.WallFilter in project druid by alibaba.
the class TestOracleWall2 method setUp.
protected void setUp() throws Exception {
dataSource = new DruidDataSource();
WallFilter wall = new WallFilter();
wall.setConfig(new WallConfig());
wall.getConfig().setWrapAllow(false);
dataSource.setOracle(true);
dataSource.setUrl("jdbc:mock:xxx");
dataSource.setDriver(new OracleMockDriver());
dataSource.setPoolPreparedStatements(true);
dataSource.setConnectionProperties("defaultRowPrefetch=50");
dataSource.setFilters("stat");
dataSource.getProxyFilters().add(wall);
dataSource.setDbType("oracle");
// dataSource.setFilters("log4j");
}
use of com.alibaba.druid.wall.WallFilter in project tesla by linking12.
the class DruidDBConfig method getProxyFilters.
private List<Filter> getProxyFilters() {
List<Filter> proxyFilters = Lists.newArrayList();
WallConfig wallConfig = new WallConfig();
wallConfig.setDir("");
wallConfig.setCommentAllow(true);
wallConfig.init();
WallFilter wallFilter = new WallFilter();
wallFilter.setDbType("mysql");
wallFilter.setConfig(wallConfig);
proxyFilters.add(wallFilter);
return proxyFilters;
}
use of com.alibaba.druid.wall.WallFilter in project neweagle-api by apgzs.
the class DruidConfiguration method wallFilter.
@Bean
public WallFilter wallFilter() {
WallFilter wallFilter = new WallFilter();
// 允许执行多条SQL
WallConfig config = new WallConfig();
config.setMultiStatementAllow(true);
wallFilter.setConfig(config);
return wallFilter;
}
use of com.alibaba.druid.wall.WallFilter in project neweagle-api by apgzs.
the class DruidConfiguration method dataSource.
@Bean
@Primary
public DataSource dataSource() {
DruidDataSource datasource = new DruidDataSource();
datasource.setUrl(this.dbUrl);
datasource.setUsername(username);
datasource.setPassword(password);
datasource.setDriverClassName(driverClassName);
// configuration
if (initialSize != null) {
datasource.setInitialSize(initialSize);
}
if (minIdle != null) {
datasource.setMinIdle(minIdle);
}
if (maxActive != null) {
datasource.setMaxActive(maxActive);
}
if (maxWait != null) {
datasource.setMaxWait(maxWait);
}
if (timeBetweenEvictionRunsMillis != null) {
datasource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);
}
if (minEvictableIdleTimeMillis != null) {
datasource.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis);
}
if (validationQuery != null) {
datasource.setValidationQuery(validationQuery);
}
if (testWhileIdle != null) {
datasource.setTestWhileIdle(testWhileIdle);
}
if (testOnBorrow != null) {
datasource.setTestOnBorrow(testOnBorrow);
}
if (testOnReturn != null) {
datasource.setTestOnReturn(testOnReturn);
}
if (poolPreparedStatements != null) {
datasource.setPoolPreparedStatements(poolPreparedStatements);
}
if (maxPoolPreparedStatementPerConnectionSize != null) {
datasource.setMaxPoolPreparedStatementPerConnectionSize(maxPoolPreparedStatementPerConnectionSize);
}
if (connectionProperties != null) {
datasource.setConnectionProperties(connectionProperties);
}
List<Filter> filters = new ArrayList<>();
filters.add(statFilter());
filters.add(wallFilter());
datasource.setProxyFilters(filters);
return datasource;
}
Aggregations