druid错误 sql injection violation, multi-statement not allow
**
错误描述:
**
druid报错
org.springframework.jdbc.UncategorizedSQLException:
Error querying database. Cause: java.sql.SQLException: sql injection violation, multi-statement not allow :
xxxxxx sql语句
**
错误分析:
**
主要引起原因是在mybatis一条sql中有多个;分割的语句,我的情况只在datasource url里添加 allowMultiQueries=true是不够的
百度里说wallfilter有问题,但是按他们的配置走不通,但是问题定位到了这里
**
问题解决:
**
查看druid github文档说明常见问题
查看druid github文档说明常见问题
31. 如何在Spring Boot中添加自定义WallConfig、Filter ?
如何在Spring Boot中添加自定义WallConfig、Filter
**
特别说明
**
这个wallfitler是我们自己定义的 需要加上multi-statement-allow: true配置
所以不能写在druid.fitler里声明
那个出来是默认的的
**
最终解决
**
在druid yml层级下添加
filter:
wall:
config:
multi-statement-allow: true
db-type: mysql
enabled: true
问题解决!