Cannot resolve configuration property ‘spring.datasource.timeBetweenEvictionRunsMillis‘

编程入门 行业动态 更新时间:2024-10-25 06:22:08

Cannot resolve configuration <a href=https://www.elefans.com/category/jswz/34/1770251.html style=property ‘spring.datasource.timeBetweenEvictionRunsMillis‘"/>

Cannot resolve configuration property ‘spring.datasource.timeBetweenEvictionRunsMillis‘

springboot  yml 配置问题如图

  

 正常配置 druid 

spring:profiles:active: devdatasource:driver-class-name: com.mysql.cj.jdbc.Driverurl: jdbc:mysql://127.0.0.1:4406/demo?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=trueusername: rootpassword: roottype: com.alibaba.druid.pool.DruidDataSourcedruid:initialSize: 5minIdle: 5maxActive: 10maxWait: 60000     #获取连接时最大等待时间,单位毫秒timeBetweenEvictionRunsMillis: 1800000     #配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒filters: stat,wall,slf4j    #通过别名的方式配置扩展插件,常用的插件有:监控统计用的filter:stat,日志用的filter: slf4j,防御sql注入的filter:wallconnectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=90;druid.stat.logSlowSql=true   # 通过connectProperties属性来打开mergeSql功能;慢SQL记录validationQuery: select 'x'   #用来检测连接是否有效的sql,要求是一个查询语句testWhileIdle: true       #建议配置为true,不影响性能,并且保证安全性。如果空闲时间大于timeBetweenEvictionRunsMillis,执行validationQuery检测连接是否有效。testOnBorrow: false       #申请连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能testOnReturn: false       #归还连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能poolPreparedStatements: false #是否缓存preparedStatement,也就是PSCache。PSCache对支持游标的数据库性能提升巨大,比如说oracle。在mysql下建议关闭
解决问题

 

更多推荐

Cannot resolve configuration property ‘spring.datasource.timeBetweenEvictionRuns

本文发布于:2024-02-27 00:04:25,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1704492.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:property   configuration   resolve   timeBetweenEvictionRunsMillis   datasource

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!