当前位置:   article > 正文

Springboot2 Druid的配置_spring.datasource.druid.keepalive

spring.datasource.druid.keepalive
  1. #Mybatis的配置
  2. #日志 让控制台打印sql语句
  3. logging.level.com.allen.druid.dao=debug
  4. #通过包扫描自定义别名,相等于mybatis的<typeAliases>的子标签<package name=com.allen.springbootmybatis.bean>
  5. #特别注意指定的包目录下,不能有重名的类,因为它是把类名首字母小写后变成别名即com.allen.springbootmybatis.bean.ScheduleBean别名是scheduleBean
  6. #别名的好处,就是你在xml文件,不用写类的全限定名,只要写别名即可
  7. mybatis.type-aliases-package=com.allen.springbootmybatis.bean
  8. #指定Mapper文件路径与名称(含匹配),扫描多个路径,中间以,分开 。支持通配符,建议每个都要以classpath*:开头
  9. mybatis.mapper-locations=classpath*:mappers/*Mapper.xml
  10. ##数据库连接配置信息
  11. spring.datasource.driverClassName =com.mysql.cj.jdbc.Driver
  12. spring.datasource.url = jdbc:mysql://localhost:3306/my_springboot?serverTimezone=UTC
  13. spring.datasource.username = root
  14. spring.datasource.password = root
  15. ##指定数据源类型
  16. spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
  1. ###########################Druid配置##########################
  2. #####连接池属性spring.datasource.druid.xxx=
  3. #启动连接池,默认开启
  4. #spring.datasource.druid.enable=true
  5. #使用Druid的数据库连接信息,我不建议使用此种 + 配置类,除非你对Druid特别熟悉
  6. #spring.datasource.druid.driver=com.mysql.cj.jdbc.Driver#指定driver的类名,默认从jdbc url中自动探测
  7. #spring.datasource.druid.driver-class-name使用这个,不用spring.datasource.druid.driver
  8. #spring.datasource.druid.driver-class-name=com.mysql.cj.jdbc.Driver
  9. #spring.datasource.druid.url=jdbc:mysql://localhost:3306/my_springboot?serverTimezone=UTC
  10. #spring.datasource.druid.username=root
  11. #spring.datasource.druid.password=root
  12. #获取连接时最大等待时间,单位毫秒
  13. #spring.datasource.druid.max-wait=10
  14. ##最大连接数
  15. #spring.datasource.druid.max-active=10
  16. ##最小连接池数量
  17. #spring.datasource.druid.min-idle=5
  18. #打开KeepAlive之后的效果
  19. #1>初始化连接池时会填充到minIdle数量。
  20. #2>连接池中的minIdle数量以内的连接,空闲时间超过minEvictableIdleTimeMillis,则会执行keepAlive操作。
  21. #3>当网络断开等原因产生的由ExceptionSorter检测出来的死连接被清除后,自动补充连接到minIdle数量。
  22. #连接池中的minIdle数量以内的连接,空闲时间超过minEvictableIdleTimeMillis,则会执行keepAlive操作
  23. #2次keepAlive操作的时间间隔
  24. #spring.datasource.druid.keep-alive-between-time-millis=50000
  25. #开启keepAlive操作
  26. spring.datasource.druid.keep-alive=true
  27. ###打开PSCache,并指定每个连接上PSCache的大小。oracle设为true,mysql设为false。分库分表较多推荐设置为false
  28. spring.datasource.druid.pool-prepared-statements=true
  29. spring.datasource.druid.max-pool-prepared-statement-per-connection-size=30
  30. ####检测,验证
  31. ##归还连接时会执行validationQuery检测连接是否有效,开启会降低性能,默认为true
  32. ####如果你的数据库经常断,必须使用此配置,否则系统需要重启(如果数据库异常有短信这类通知,建议关闭)
  33. spring.datasource.druid.test-on-return=false
  34. ##用来检测连接是否有效的sql 必须是一个查询语句,spring.datasource.druid.test-on-return设置true才能用
  35. ##mysql、oracle中为 select 1 from dual,不知道为啥mysql,网上推荐SELECT 'x'
  36. spring.datasource.druid.validation-query=select 1 from dual
  37. ##申请连接的时候检测,如果空闲时间大于timeBetweenEvictionRunsMillis,执行validationQuery检测连接是否有效。
  38. spring.datasource.druid.test-while-idle=true
  39. ## 当从连接池借用连接时,是否测试该连接,建议测试false
  40. spring.datasource.druid.test-on-borrow=false
  41. ##既作为检测的间隔时间又作为testWhileIdel执行的依据即此值决定是否空闲,因此此值一定要设置合理
  42. #即一个空闲线程,最大的生成时间。检测需要关闭的空闲连接
  43. #spring.datasource.druid.time-between-eviction-runs-millis=60000
  44. ##销毁线程时检测当前连接的最后活动时间和当前时间差大于该值时,关闭当前连接即一个连接在池中最小生存的时间
  45. #spring.datasource.druid.min-evictable-idle-time-millis=3000
  46. #指定连接变量。eg开启慢sql功能=druid.stat.mergeSql=true;druid.stat.slowSqlMillis=500
  47. #spring.datasource.druid.connection-properties=String
  48. #合并多个DruidDataSource的监控数据
  49. #spring.datasource.druid.use-global-data-source-stat=true
  50. ##允许访问底层连接
  51. #spring.datasource.druid.access-to-underlying-connection-allowed=true
  52. #活跃连接堆跟踪
  53. #spring.datasource.druid.active-connection-stack-trace=List<String>
  54. #活跃连接列表
  55. #spring.datasource.druid.active-connections=Set<DruidPooledConnection>
  56. ##启用异步关闭连接
  57. #spring.datasource.druid.async-close-connection-enable=true
  58. #开启异步初始化
  59. #spring.datasource.druid.async-init=true
  60. #失败后跳过即用于失败重连,默认为false,true表示向数据库请求连接失败后,就算后端数据库恢复正常也不进行重连
  61. #因此一定要配置false
  62. #spring.datasource.druid.break-after-acquire-failure=false
  63. #检查执行sql执行时间
  64. #spring.datasource.druid.check-execute-time=true
  65. #启动清除过滤器
  66. #spring.datasource.druid.clear-filters-enable=false
  67. #连接出错尝试几次重新连接
  68. #spring.datasource.druid.connection-error-retry-attempts=2
  69. ####连接初始化语句即写sql语句,连接后会自动执行,用于测试比较好
  70. #spring.datasource.druid.connection-init-sqls=Collection<String>
  71. #spring.datasource.druid.connection-init-sqls=update t_schedule set status=0
  72. #创建定时器的连接池,跟数据库连接有关
  73. #spring.datasource.druid.create-scheduler=java.util.concurrent.ScheduledExecutorService
  74. #指定db类型,eg:h2、mysq、oracle
  75. #spring.datasource.druid.db-type=String
  76. #指定默认值:事务是否自动提交
  77. #spring.datasource.druid.default-auto-commit=true
  78. #指定连接默认的catalog.
  79. #spring.datasource.druid.default-catalog=String
  80. #是否设置默认连接只读.
  81. #spring.datasource.druid.default-read-only=true
  82. #指定连接的事务的默认隔离级别.
  83. #-1 数据库默认隔离级别
  84. #1 未提交读
  85. #2 读写提交
  86. #4 可重复读
  87. #8 串行化
  88. #spring.datasource.druid.default-transaction-isolation=Integer
  89. #指定销毁的定时连接池
  90. #spring.datasource.druid.destroy-scheduler=java.util.concurrent.ScheduledExecutorService
  91. ##启用DUP关闭日志
  92. #spring.datasource.druid.dup-close-log-enable=true
  93. #当数据库抛出不可恢复的异常时,抛弃该连接
  94. #spring.datasource.druid.exception-sorter=com.alibaba.druid.pool.ExceptionSorter
  95. #指定ExceptionSorter类名
  96. #spring.datasource.druid.exception-sorter-class-name=String
  97. #当创建连接池时,创建失败后是否立即抛异常
  98. #spring.datasource.druid.fail-fast=true
  99. #DruidStatProperties的aopPatterns字段即指定AOP模式
  100. #spring.datasource.druid.aop-patterns=String[]
  101. #Spring监控,对内部各接口调用的监控,参考Druid Github Wiki,配置_Druid和Spring关联监控配置
  102. #spring.datasource.druid.aop-patterns=com.allen.service.*,com.allen.dao.*,com.allen.controller.*,com.allen.mapper.*
  103. ###连接池初始化
  104. #开启线程初始化异常抛出异常
  105. #spring.datasource.druid.init-exception-throw=true
  106. #false #初始化全局变量
  107. #spring.datasource.druid.init-global-variants=true
  108. ##初始化变量
  109. #spring.datasource.druid.init-variants=true
  110. ##初始化时建立物理连接的个数
  111. #spring.datasource.druid.initial-size=10
  112. #socket连接超时时kil
  113. #spring.datasource.druid.kill-when-socket-read-timeout=true
  114. #记录丢失
  115. #spring.datasource.druid.log-abandoned=true
  116. #记录不同的线程
  117. #spring.datasource.druid.log-different-thread=true
  118. #指定连接数据库的超时时间
  119. #spring.datasource.druid.login-timeout=Integer
  120. #最大创建任务数
  121. #spring.datasource.druid.max-create-task-count=1000
  122. ##连接保持空闲而不被驱逐的最大时间.默认值1000L * 60L * 60L * 7,com.alibaba.druid.pool.DruidAbstractDataSource.maxEvictableIdleTimeMillis
  123. #spring.datasource.druid.max-evictable-idle-time-millis=1000
  124. #最大打开的prepared-statement数量
  125. #spring.datasource.druid.max-open-prepared-statements=1000
  126. #允许的最大线程等待数
  127. #spring.datasource.druid.max-wait-thread-count=10
  128. #指定连接池名称
  129. #spring.datasource.druid.name=String
  130. #设置获取连接时的重试次数,-1为不重试
  131. #spring.datasource.druid.not-full-timeout-retry-count=-1
  132. #????
  133. #spring.datasource.druid.object-name=
  134. #用于控制当OnFatalError发生时最大使用连接数量,用于控制异常发生时并发执行SQL的数量,减轻数据库恢复的压力。
  135. #默认值 0
  136. #spring.datasource.druid.on-fatal-error-max-active=Integer
  137. #是否是oracle数据库
  138. #spring.datasource.druid.oracle=false
  139. #用于解决数据库密码加密处理方法
  140. #public class AllenDbPasswordCallback extends DruidPasswordCallback {
  141. # private static final Logger LOGGER = LoggerFactory.getLogger(DbPasswordCallback.class);
  142. # @Override
  143. # public void setProperties(Properties properties) {
  144. # super.setProperties(properties);
  145. # 真实环境,这2个值存数据库
  146. # String password = (String) properties.get("password");
  147. # String publickey = (String) properties.get("publickey");
  148. # try {
  149. # String dbpassword = ConfigTools.decrypt(publickey, password);
  150. # setPassword(dbpassword.toCharArray());
  151. # } catch (Exception e) {
  152. # LOGGER.error("Druid ConfigTools.decrypt", e);
  153. # }
  154. # }
  155. #}
  156. #spring.datasource.druid.password-callback=javax.security.auth.callback.PasswordCallback
  157. #物理最大连接数
  158. #spring.datasource.druid.phy-max-use-count=1000
  159. #物理超时
  160. #spring.datasource.druid.phy-timeout-millis=Long
  161. #???
  162. #spring.datasource.druid.pooling-connection-info=List<Map<String,Object>>
  163. #指定代理过滤器
  164. #spring.datasource.druid.proxy-filters=List<Filter>
  165. #查询超时时间
  166. #spring.datasource.druid.query-timeout=Integer
  167. #指定当连接超过废弃超时时间时,是否立刻删除该连接.
  168. #spring.datasource.druid.remove-abandoned=true
  169. #指定连接应该被废弃的时间.
  170. #spring.datasource.druid.remove-abandoned-timeout=Integer
  171. #废弃连接超时指定时间的连接
  172. #spring.datasource.druid.remove-abandoned-timeout-millis=Long
  173. #启用重置统计信息
  174. #spring.datasource.druid.reset-stat-enable=true
  175. #共享预处理语句
  176. #spring.datasource.druid.share-prepared-statements=true
  177. #指定2次错误连接的最大时间间隔
  178. #spring.datasource.druid.time-between-connect-error-millis=
  179. #统计日志之间的时间
  180. #spring.datasource.druid.time-between-log-stats-millis=
  181. ##事务查询超时时间
  182. #spring.datasource.druid.transaction-query-timeout=Integer
  183. # 事务时间阈值
  184. #spring.datasource.druid.transaction-threshold-millis=Long
  185. #使用本地session是stat
  186. #spring.datasource.druid.use-local-session-state=true
  187. # 使用oracle隐式缓存
  188. #spring.datasource.druid.use-oracle-implicit-cache=true
  189. # 使用非公平锁
  190. #spring.datasource.druid.use-unfair-lock=true
  191. #com.alibaba.druid.pool.DruidAbstractDataSource.userCallback
  192. #spring.datasource.druid.user-callback=
  193. #指定连接的有效检查类
  194. #spring.datasource.druid.valid-connection-checker=com.alibaba.druid.pool.ValidConnectionChecker
  195. #spring.datasource.druid.valid-connection-checker-class-name=String
  196. #单位:秒,检测连接是否有效的超时时间。底层调用jdbc Statement对象的void setQueryTimeout(int seconds)方法
  197. #spring.datasource.druid.validation-query-timeout=Integer
  198. ################################filters#############################################
  199. # 配置扩展插件:配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
  200. #spring.datasource.druid.filters=String
  201. #sql无法统计时,去除wall
  202. #spring.datasource.druid.filters=stat,wall,log4j,config
  203. #允许一次执行多条语句,与spring.datasource.druid.filters的wall值有关
  204. #wall是com.alibaba.druid.wall.WallFilter的简称,提供sql的检查和过滤等功能
  205. # 默认对混合SQL进行拦截,此处为了执行大SQL,可关闭防火墙功能。
  206. #如果需要开启wall监控,同时允许multiStatementAllow,就不要在application中配置filter。
  207. #spring.datasource.druid.filter.wall.config.multi-statement-allow=true
  208. ####开启慢sql
  209. ##合并sql,默认false
  210. #spring.datasource.druid.filter.stat.merge-sql=true
  211. #spring.datasource.druid.filter.stat.log-slow-sql=true
  212. ##sql的执行时间超过1500毫秒就是慢sql
  213. #spring.datasource.druid.filter.stat.slow-sql-millis=1500
  214. ####慢sql结束
  215. #druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
  216. #spring.datasource.druid.connect-properties=Map<String,String>
  217. #eg:开启慢sql的另一种方式
  218. #spring.datasource.druid.connect-properties.=druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
  219. #指定过滤器名称
  220. #spring.datasource.druid.filter-class-names=List<String>
  221. #启用Enable ConfigFilter
  222. #spring.datasource.druid.filter.config.enabled=true
  223. #启用EncodingConvertFilter
  224. #spring.datasource.druid.filter.encoding.enabled=true
  225. #???
  226. #spring.datasource.druid.sql-stat-map.=Map<String,JdbcSqlStat>
  227. #???
  228. #spring.datasource.druid.stat-data.=Map<String,Object>
  229. #????
  230. #spring.datasource.druid.stat-data-for-m-bean.=Map<String,Object>
  231. ##################################stat######################################
  232. #启用
  233. #spring.datasource.druid.filter.stat.enabled=true
  234. #指定stat的logger实现类
  235. #spring.datasource.druid.stat-logger=com.alibaba.druid.pool.DruidDataSourceStatLogger
  236. #指定stat的数据库类型
  237. #spring.datasource.druid.filter.stat.db-type=mysql
  238. #启动连接堆跟踪,com.alibaba.druid.filter.stat.StatFilter的connectionStackTraceEnable字段,默认false
  239. #spring.datasource.druid.filter.stat.connection-stack-trace-enable=true
  240. ###############################stat-view-servlet#######################
  241. # 白名单 ;com.alibaba.druid.spring.boot.autoconfigure.properties.DruidStatProperties.StatViewServlet#allow
  242. #spring.datasource.druid.stat-view-servlet.allow=String
  243. #黑名单
  244. #spring.datasource.druid.stat-view-servlet.deny=String
  245. #开启
  246. #spring.datasource.druid.stat-view-servlet.enabled=true
  247. #登录密码
  248. #spring.datasource.druid.stat-view-servlet.login-password=
  249. #登录用户名
  250. #spring.datasource.druid.stat-view-servlet.login-username=
  251. #启用重置统计信息
  252. #spring.datasource.druid.stat-view-servlet.reset-enable=String
  253. ##访问路径
  254. #spring.datasource.druid.stat-view-servlet.url-pattern=String
  255. ###############################web-stat-filter#######################
  256. #启用开关
  257. #spring.datasource.druid.web-stat-filter.enabled=true
  258. # #排除URL com.alibaba.druid.spring.boot.autoconfigure.properties.DruidStatProperties.WebStatFilter
  259. #spring.datasource.druid.web-stat-filter.exclusions= *.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*
  260. #身份标识 从session中获取spring.datasource.druid.web-stat-filter.principal-session-name=身份标识
  261. # 从cookie中获取 例如cookie中存gk=xiaoming 设置属性为gk即可
  262. #spring.datasource.druid.web-stat-filter.principal-session-name=String
  263. #spring.datasource.druid.web-stat-filter.principal-cookie-name=
  264. #配置profileEnable能够监控单个url调用的sql列表
  265. # com.alibaba.druid.spring.boot.autoconfigure.properties.DruidStatProperties.WebStatFilter.profileEnable
  266. #spring.datasource.druid.web-stat-filter.profile-enable=String true
  267. #开关session统计功
  268. #spring.datasource.druid.web-stat-filter.session-stat-enable=true
  269. # 默认sessionStatMaxCount是1000个,你也可以按需要进行配置
  270. #spring.datasource.druid.web-stat-filter.session-stat-max-count=
  271. #statFilter的url模式,支持正则表达式
  272. #spring.datasource.druid.web-stat-filter.url-pattern=/*
  273. # 排除一些不必要的url,比如.js,/jslib/等等
  274. #spring.datasource.druid.web-stat-filter.exclusions=*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*
  275. ###############################防火墙开始filter.wall###############################
  276. #开启Wall功能
  277. #spring.datasource.druid.filter.wall.enabled=true
  278. #Map<String,Object>
  279. #spring.datasource.druid.wall-stat-map.=allen=java.lang.String;gk=allen
  280. #是否允许执行Alter Table语句
  281. #spring.datasource.druid.filter.wall.config.alter-table-allow=true
  282. #是否允许阻塞
  283. #spring.datasource.druid.filter.wall.config.block-allow=true
  284. #是否允许通过jdbc的call语法调用存储过程
  285. #spring.datasource.druid.filter.wall.config.call-allow=true
  286. #com.alibaba.druid.wall.WallConfig.caseConditionConstAllow
  287. #spring.datasource.druid.filter.wall.config.case-condition-const-allow=true
  288. #默认false 是否允许语句中存在注释,Oracle的用户不用担心,Wall能够识别hints和注释的区别
  289. #spring.datasource.druid.filter.wall.config.comment-allow=true
  290. #默认true 是否允许执行commit操作
  291. #spring.datasource.druid.filter.wall.config.commit-allow=true
  292. # 默认值:false ??
  293. #spring.datasource.druid.filter.wall.config.complete-insert-values-check=true
  294. #默认值false。检查查询条件(WHERE/HAVING子句)中是否包含AND永假条件
  295. #spring.datasource.druid.filter.wall.config.condition-and-alway-false-allow=true
  296. #默认值false:检查查询条件(WHERE/HAVING子句)中是否包含AND永真条件
  297. #spring.datasource.druid.filter.wall.config.condition-and-alway-true-allow=true
  298. #默认值false 查询条件中是否允许连续两个常量运算表达式
  299. #spring.datasource.druid.filter.wall.config.condition-double-const-allow=true
  300. #默认值true,检查查询条件(WHERE/HAVING子句)中是否包含LIKE永真条件
  301. #spring.datasource.druid.filter.wall.config.condition-like-true-allow=true
  302. #默认值:true。查询条件中是否允许有"&"、"~"、"|"、"^"运算符。
  303. #spring.datasource.druid.filter.wall.config.condition-op-bitwse-allow=true
  304. #默认值:false 查询条件中是否允许有XOR条件。XOR不常用,很难判断永真或者永假,缺省不允许。
  305. #spring.datasource.druid.filter.wall.config.condition-op-xor-allow=true
  306. #默认值true。拦截常量运算的条件,比如说WHERE FID = 3 - 1,其中"3 - 1"是常量运算表达式。
  307. #spring.datasource.druid.filter.wall.config.const-arithmetic-allow=true
  308. #默认值true,是否允许创建表
  309. #spring.datasource.druid.filter.wall.config.create-table-allow=true
  310. #默认值true,是否允许执行DELETE语句
  311. #spring.datasource.druid.filter.wall.config.delete-allow=true
  312. #默认true,检查DELETE语句的WHERE子句是否是一个永真条件
  313. #spring.datasource.druid.filter.wall.config.delete-where-alway-true-check=true
  314. #false,检查DELETE语句是否无where条件,这是有风险的,但不是SQL注入类型的风险
  315. #spring.datasource.druid.filter.wall.config.delete-where-none-check=true
  316. #???com.alibaba.druid.wall.WallConfig.denyFunctions
  317. #spring.datasource.druid.filter.wall.config.deny-functions=Set<String>
  318. #com.alibaba.druid.wall.WallConfig.denyObjects
  319. #spring.datasource.druid.filter.wall.config.deny-objects=Set<String>
  320. #com.alibaba.druid.wall.WallConfig.denySchemas
  321. #spring.datasource.druid.filter.wall.config.deny-schemas=Set<String>
  322. #com.alibaba.druid.wall.WallConfig.denyTables
  323. #spring.datasource.druid.filter.wall.config.deny-tables=Set<String>
  324. #com.alibaba.druid.wall.WallConfig.denyVariants
  325. #spring.datasource.druid.filter.wall.config.deny-variants=
  326. #true 是否允许执行mysql的describe语句,缺省打开
  327. #spring.datasource.druid.filter.wall.config.describe-allow=true
  328. #按照dbType分别配置: mysql : META-INF/druid/wall/mysql oracle : META-INF/druid/wall/oracle sqlserver : META-INF/druid/wall/sqlserver
  329. #spring.datasource.druid.filter.wall.config.dir=String
  330. #false,特权允许
  331. #spring.datasource.druid.filter.wall.config.do-privileged-allow=true
  332. #true 是否允许修改表
  333. #spring.datasource.druid.filter.wall.config.drop-table-allow=true
  334. #true,检测是否使用了禁用的函数
  335. #spring.datasource.druid.filter.wall.config.function-check=true
  336. #spring.datasource.druid.filter.wall.config.hint-allow=true
  337. #???
  338. #spring.datasource.druid.filter.wall.config.inited=true
  339. #true,是否允许执行INSERT语句
  340. #spring.datasource.druid.filter.wall.config.insert-allow=true
  341. #默认值3
  342. #spring.datasource.druid.filter.wall.config.insert-values-check-size=Integer
  343. #true,是否允许SELECT FROM A INTERSECT SELECT FROM B这样的语句
  344. #spring.datasource.druid.filter.wall.config.intersect-allow=true
  345. #false,是否允许limit 0这样的语句
  346. #spring.datasource.druid.filter.wall.config.limit-zero-allow=true
  347. #true,锁表允许
  348. #spring.datasource.druid.filter.wall.config.lock-table-allow=true
  349. #true,是否允许执行MERGE语句,这个只在Oracle中有用
  350. #spring.datasource.druid.filter.wall.config.merge-allow=true
  351. #true,是否允许调用Connection.getMetadata方法,这个方法调用会暴露数据库的表信息
  352. #spring.datasource.druid.filter.wall.config.metadata-allow=true
  353. #true,是否允许SELECT FROM A MINUS SELECT FROM B这样的语句
  354. #spring.datasource.druid.filter.wall.config.minus-allow=true
  355. #false。是否必须参数化,如果为True,则不允许类似WHERE ID = 1这种不参数化的SQL
  356. #spring.datasource.druid.filter.wall.config.must-parameterized=true
  357. #false。是否允许非以上基本语句的其他语句,缺省关闭,通过这个选项就能够屏蔽DDL。
  358. #spring.datasource.druid.filter.wall.config.none-base-statement-allow=true
  359. #true,检测是否使用了“禁用对对象”
  360. #spring.datasource.druid.filter.wall.config.object-check=true
  361. #???
  362. #spring.datasource.druid.filter.wall.config.permit-functions=Set<String>
  363. # 允许的schemas集合
  364. #spring.datasource.druid.filter.wall.config.permit-schemas=Set<String>
  365. #允许table名集合
  366. #spring.datasource.druid.filter.wall.config.permit-tables=Set<String>
  367. #允许变量集合
  368. #spring.datasource.druid.filter.wall.config.permit-variants=Set<String>
  369. #只允许读的表
  370. #spring.datasource.druid.filter.wall.config.read-only-tables=Set<String>
  371. #true。是否允许表重命名
  372. #spring.datasource.druid.filter.wall.config.rename-table-allow=true
  373. #true。是否允许执行REPLACE语句
  374. #spring.datasource.druid.filter.wall.config.replace-allow=true
  375. #true。是否允许执行roll back操作
  376. #spring.datasource.druid.filter.wall.config.rollback-allow=true
  377. #true,检测是否使用了禁用的Schema
  378. #spring.datasource.druid.filter.wall.config.schema-check=true
  379. # ??? true,不允许执行select * from t,但select from (select id, name from t) a。
  380. # 这个选项是防御程序通过调用select 获得数据表的结构信息。
  381. #spring.datasource.druid.filter.wall.config.select-all-column-allow=true
  382. #true,检测SELECT EXCEPT
  383. #spring.datasource.druid.filter.wall.config.select-except-check=true
  384. #true,检查SELECT语句的HAVING子句是否是一个永真条件
  385. #spring.datasource.druid.filter.wall.config.select-having-alway-true-check=true
  386. #true,检测SELECT INTERSECT
  387. #spring.datasource.druid.filter.wall.config.select-intersect-check=true
  388. #true,SELECT查询中是否允许INTO字句
  389. #spring.datasource.druid.filter.wall.config.select-into-allow=true
  390. #true.SELECT … INTO OUTFILE 是否允许,这个是mysql注入攻击的常见手段,缺省是禁止的
  391. #spring.datasource.druid.filter.wall.config.select-into-outfile-allow=true
  392. #默认值-1;配置最大返回行数,如果select语句没有指定最大返回行数,会自动修改selct添加返回限制
  393. #spring.datasource.druid.filter.wall.config.select-limit=Integer
  394. #true,检测SELECT MINUS
  395. #spring.datasource.druid.filter.wall.config.select-minus-check=true
  396. #true,检测SELECT union
  397. #spring.datasource.druid.filter.wall.config.select-union-check=true
  398. #true,检查SELECT语句的WHERE子句是否是一个永真条件
  399. #spring.datasource.druid.filter.wall.config.select-where-alway-true-check=true
  400. #true,是否允许执行SELECT语句
  401. #spring.datasource.druid.filter.wall.config.selelct-allow=true
  402. #true.是否允许使用SET语法
  403. #spring.datasource.druid.filter.wall.config.set-allow=true
  404. #true.是否允许执行mysql的show语句,缺省打开
  405. #spring.datasource.druid.filter.wall.config.show-allow=true
  406. #true.是否允许开启事务
  407. #spring.datasource.druid.filter.wall.config.start-transaction-allow=true
  408. #true, 是否进行严格的语法检测,
  409. # Druid SQL Parser在某些场景不能覆盖所有的SQL语法,出现解析SQL出错,可以临时把这个选项设置为false,同时把SQL反馈给Druid的开发者。
  410. #spring.datasource.druid.filter.wall.config.strict-syntax-check=true
  411. #true,检测是否使用了禁用的表
  412. #spring.datasource.druid.filter.wall.config.table-check=true
  413. #??
  414. #spring.datasource.druid.filter.wall.config.tenant-column=String
  415. #???
  416. #spring.datasource.druid.filter.wall.config.tenant-table-pattern=String
  417. #true,truncate语句是危险,缺省打开,若需要自行关闭
  418. #spring.datasource.druid.filter.wall.config.truncate-allow=true
  419. #true,是否允许update语法
  420. #spring.datasource.druid.filter.wall.config.update-allow=true
  421. #指定UpdateCheck处理器
  422. #spring.datasource.druid.filter.wall.config.update-check-handler=com.alibaba.druid.wall.WallUpdateCheckHandler
  423. #true.检查UPDATE语句的WHERE子句是否是一个永真条件
  424. #spring.datasource.druid.filter.wall.config.update-where-alay-true-check=true
  425. #false,检查UPDATE语句是否无where条件,这是有风险的,但不是SQL注入类型的风险
  426. #spring.datasource.druid.filter.wall.config.update-where-none-check=true
  427. #true,是否允许执行mysql的use语句,缺省打开
  428. #spring.datasource.druid.filter.wall.config.use-allow=true
  429. #true.检测是否使用了“禁用的变量”
  430. #spring.datasource.druid.filter.wall.config.variant-check=true
  431. #true,是否允许调用Connection/Statement/ResultSet的isWrapFor和unwrap方法,
  432. # 这两个方法调用,使得有办法拿到原生驱动的对象,绕过WallFilter的检测直接执行SQL。
  433. #spring.datasource.druid.filter.wall.config.wrap-allow=true
  434. #指定Wall的配置类,可以继承WallConfig类,然后指定即可
  435. #spring.datasource.druid.filter.wall.config=com.alibaba.druid.wall.WallConfig
  436. #指定数据库类型,mysql
  437. #spring.datasource.druid.filter.wall.db-type=String
  438. #默认false,对被认为是攻击的SQL进行LOG.error输出
  439. #spring.datasource.druid.filter.wall.log-violation=true
  440. #provider 白名单 ???
  441. #spring.datasource.druid.filter.wall.provider-white-list=Set<String>
  442. #???
  443. #spring.datasource.druid.filter.wall.tenant-column=String
  444. #true,对被认为是攻击的SQL抛出SQLException
  445. #spring.datasource.druid.filter.wall.throw-exception=true
  446. ###防火墙结束
  447. ###################################日志的处理###################################
  448. ########################commons-log 日志开始#####################
  449. #spring.datasource.druid.filter.commons-log.connection-close-after-log-enabled=true
  450. #spring.datasource.druid.filter.commons-log.connection-commit-after-log-enabled=true
  451. #spring.datasource.druid.filter.commons-log.connection-connect-after-log-enabled=true
  452. #spring.datasource.druid.filter.commons-log.connection-connect-before-log-enabled=true
  453. #spring.datasource.druid.filter.commons-log.connection-log-enabled=true
  454. #spring.datasource.druid.filter.commons-log.connection-log-error-enabled=true
  455. #spring.datasource.druid.filter.commons-log.connection-logger-name=
  456. #spring.datasource.druid.filter.commons-log.connection-rollback-after-log-enabled=true
  457. #spring.datasource.druid.filter.commons-log.data-source-log-enabled=true
  458. #spring.datasource.druid.filter.commons-log.data-source-logger-name=
  459. #spring.datasource.druid.filter.commons-log.enabled=true
  460. #spring.datasource.druid.filter.commons-log.result-set-close-after-log-enabled=true
  461. #spring.datasource.druid.filter.commons-log.result-set-log-enabled=true
  462. #spring.datasource.druid.filter.commons-log.result-set-log-error-enabled=true
  463. #spring.datasource.druid.filter.commons-log.result-set-logger-name=
  464. #spring.datasource.druid.filter.commons-log.result-set-next-after-log-enabled=true
  465. #spring.datasource.druid.filter.commons-log.result-set-open-after-log-enabled=true
  466. #spring.datasource.druid.filter.commons-log.statement-close-after-log-enabled=true
  467. #spring.datasource.druid.filter.commons-log.statement-create-after-log-enabled=true
  468. #spring.datasource.druid.filter.commons-log.statement-executable-sql-log-enable=true
  469. #spring.datasource.druid.filter.commons-log.statement-execute-after-log-enabled=true
  470. #spring.datasource.druid.filter.commons-log.statement-execute-batch-after-log-enabled=true
  471. #spring.datasource.druid.filter.commons-log.statement-execute-query-after-log-enabled=true
  472. #spring.datasource.druid.filter.commons-log.statement-execute-update-after-log-enabled=true
  473. #spring.datasource.druid.filter.commons-log.statement-log-enabled=true
  474. #spring.datasource.druid.filter.commons-log.statement-log-error-enabled=true
  475. #spring.datasource.druid.filter.commons-log.statement-logger-name=
  476. #spring.datasource.druid.filter.commons-log.statement-parameter-clear-log-enable=true
  477. #spring.datasource.druid.filter.commons-log.statement-parameter-set-log-enabled=true
  478. #spring.datasource.druid.filter.commons-log.statement-prepare-after-log-enabled=true
  479. #spring.datasource.druid.filter.commons-log.statement-prepare-call-after-log-enabled=true
  480. #spring.datasource.druid.filter.commons-log.statement-sql-format-option=
  481. #spring.datasource.druid.filter.commons-log.statement-sql-pretty-format=true
  482. ##commons-log 日志结束
  483. ########################日志log4j开始 日志开始#####################
  484. ###
  485. #spring.datasource.druid.filter.log4j.connection-close-after-log-enabled=true
  486. #spring.datasource.druid.filter.log4j.connection-commit-after-log-enabled=true
  487. #spring.datasource.druid.filter.log4j.connection-connect-after-log-enabled=true
  488. #spring.datasource.druid.filter.log4j.connection-connect-before-log-enabled=true
  489. #spring.datasource.druid.filter.log4j.connection-log-enabled=true
  490. #spring.datasource.druid.filter.log4j.connection-log-error-enabled=true
  491. #spring.datasource.druid.filter.log4j.connection-logger-name=
  492. #spring.datasource.druid.filter.log4j.connection-rollback-after-log-enabled=true
  493. #spring.datasource.druid.filter.log4j.data-source-log-enabled=true
  494. #spring.datasource.druid.filter.log4j.data-source-logger-name=
  495. #spring.datasource.druid.filter.log4j.enabled=true
  496. #spring.datasource.druid.filter.log4j.result-set-close-after-log-enabled=true
  497. #spring.datasource.druid.filter.log4j.result-set-log-enabled=true
  498. #spring.datasource.druid.filter.log4j.result-set-log-error-enabled=true
  499. #spring.datasource.druid.filter.log4j.result-set-logger-name=
  500. #spring.datasource.druid.filter.log4j.result-set-next-after-log-enabled=true
  501. #spring.datasource.druid.filter.log4j.result-set-open-after-log-enabled=true
  502. #spring.datasource.druid.filter.log4j.statement-close-after-log-enabled=true
  503. #spring.datasource.druid.filter.log4j.statement-create-after-log-enabled=true
  504. #spring.datasource.druid.filter.log4j.statement-executable-sql-log-enable=true
  505. #spring.datasource.druid.filter.log4j.statement-execute-after-log-enabled=true
  506. #spring.datasource.druid.filter.log4j.statement-execute-batch-after-log-enabled=true
  507. #spring.datasource.druid.filter.log4j.statement-execute-query-after-log-enabled=true
  508. #spring.datasource.druid.filter.log4j.statement-execute-update-after-log-enabled=true
  509. #spring.datasource.druid.filter.log4j.statement-log-enabled=true
  510. #spring.datasource.druid.filter.log4j.statement-log-error-enabled=true
  511. #spring.datasource.druid.filter.log4j.statement-logger-name=
  512. #spring.datasource.druid.filter.log4j.statement-parameter-clear-log-enable=true
  513. #spring.datasource.druid.filter.log4j.statement-parameter-set-log-enabled=true
  514. #spring.datasource.druid.filter.log4j.statement-prepare-after-log-enabled=true
  515. #spring.datasource.druid.filter.log4j.statement-prepare-call-after-log-enabled=true
  516. #spring.datasource.druid.filter.log4j.statement-sql-format-option=
  517. #spring.datasource.druid.filter.log4j.statement-sql-pretty-format=true
  518. ###日志log4j结束
  519. ########################日志log4j2日志开始#####################
  520. ###
  521. #spring.datasource.druid.filter.log4j2.connection-close-after-log-enabled=true
  522. #spring.datasource.druid.filter.log4j2.connection-commit-after-log-enabled=true
  523. #spring.datasource.druid.filter.log4j2.connection-connect-after-log-enabled=true
  524. #spring.datasource.druid.filter.log4j2.connection-connect-before-log-enabled=true
  525. #spring.datasource.druid.filter.log4j2.connection-log-enabled=true
  526. #spring.datasource.druid.filter.log4j2.connection-log-error-enabled=true
  527. #spring.datasource.druid.filter.log4j2.connection-logger-name=
  528. #spring.datasource.druid.filter.log4j2.connection-rollback-after-log-enabled=true
  529. #spring.datasource.druid.filter.log4j2.data-source-log-enabled=true
  530. #spring.datasource.druid.filter.log4j2.data-source-logger-name=
  531. #spring.datasource.druid.filter.log4j2.enabled=true
  532. #spring.datasource.druid.filter.log4j2.result-set-close-after-log-enabled=true
  533. #spring.datasource.druid.filter.log4j2.result-set-log-enabled=true
  534. #spring.datasource.druid.filter.log4j2.result-set-log-error-enabled=true
  535. #spring.datasource.druid.filter.log4j2.result-set-logger-name=
  536. #spring.datasource.druid.filter.log4j2.result-set-next-after-log-enabled=true
  537. #spring.datasource.druid.filter.log4j2.result-set-open-after-log-enabled=true
  538. #spring.datasource.druid.filter.log4j2.statement-close-after-log-enabled=true
  539. #spring.datasource.druid.filter.log4j2.statement-create-after-log-enabled=true
  540. #spring.datasource.druid.filter.log4j2.statement-executable-sql-log-enable=true
  541. #spring.datasource.druid.filter.log4j2.statement-execute-after-log-enabled=true
  542. #spring.datasource.druid.filter.log4j2.statement-execute-batch-after-log-enabled=true
  543. #spring.datasource.druid.filter.log4j2.statement-execute-query-after-log-enabled=true
  544. #spring.datasource.druid.filter.log4j2.statement-execute-update-after-log-enabled=true
  545. #spring.datasource.druid.filter.log4j2.statement-log-enabled=true
  546. #spring.datasource.druid.filter.log4j2.statement-log-error-enabled=true
  547. #spring.datasource.druid.filter.log4j2.statement-logger-name=
  548. #spring.datasource.druid.filter.log4j2.statement-parameter-clear-log-enable=true
  549. #spring.datasource.druid.filter.log4j2.statement-parameter-set-log-enabled=true
  550. #spring.datasource.druid.filter.log4j2.statement-prepare-after-log-enabled=true
  551. #spring.datasource.druid.filter.log4j2.statement-prepare-call-after-log-enabled=true
  552. #spring.datasource.druid.filter.log4j2.statement-sql-format-option=
  553. #spring.datasource.druid.filter.log4j2.statement-sql-pretty-format=true
  554. ###日志log4j2结束
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/AllinToyou/article/detail/336956
推荐阅读
相关标签
  

闽ICP备14008679号