WallFilter wallDefault = new WallFilter();
wallDefault.setDbType("sqlserver");
WallConfig wc = new WallConfig();
wc.setMultiStatementAllow(true);
wallDefault.setConfig(wc);
druidPlugin.addFilter(wallDefault);
batch execute Sql:
DELETE FROM table1 WHERE main_id=?
DELETE FROM table2 WHERE main_id=?
DELETE FROM table3 WHERE main_id=?
Exception info: Caused by: java.sql.SQLException: sql injection violation, multi-statement not allow .
When I trace the source code class “WallProvider”,I find that "setMultiStatementAllow" doesn't work.
4条答案
按热度按时间fslejnso1#
这个问题应该怎么解决呢,我也是遇到这个问题了
7kqas0il2#
我也遇到类似的问题,通过在创建数据源的时候添加一个wallFilter解决了
@bean
@ConfigurationProperties(prefix = "spring.datasource")
public DataSource druidDataSource() {
DruidDataSource dataSource = new DruidDataSource();
d7v8vwbk3#
我也遇到类似的问题,通过在创建数据源的时候添加一个wallFilter解决了
@bean
@ConfigurationProperties(prefix = "spring.datasource")
public DataSource druidDataSource() {
DruidDataSource dataSource = new DruidDataSource();
这个可以解决,但是配置在yml文件里的配置不会赋值到datasource里
u4vypkhs4#
I have the same issue, I found out that the construct function
WallFilter()
was called several times, so there are several instances of WallFilter, only one of it has thetruevalue onwallConfig.multiStatementAllow
. When runningWallProvider.checkInternal
, the config hasfalsevalue,(╯︵╰)