# 数据源配置 
 | 
spring: 
 | 
    datasource: #配置数据源 
 | 
        ym: 
 | 
            #name: ym 
 | 
            type: com.alibaba.druid.pool.DruidDataSource 
 | 
            driverClassName: com.mysql.cj.jdbc.Driver 
 | 
            url: jdbc:mysql://192.168.40.166:3306/pipIrr_ym?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull 
 | 
#            url: jdbc:mysql://8.130.130.233:3306/pipIrr_ym?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull 
 | 
#            url: jdbc:mysql://127.0.0.1:3306/pipIrr_ym?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull 
 | 
            username: root 
 | 
            password: dysql,;.abc!@# 
 | 
            druid: 
 | 
                # 数据源名称:当存在多个数据源时,设置名字可以很方便的来进行区分,默认自动生成名称,格式是:"DataSource-" + System.identityHashCode(this) 
 | 
                name: druid-mysql-ym 
 | 
                #配置初始化大小、最小、最大 
 | 
                initialSize: 10 
 | 
                minIdle: 10 
 | 
                maxActive: 100 
 | 
                # 获取连接时最大等待时间,单位毫秒。配置了maxWait之后,缺省启用公平锁,并发效率会有所下降,如果需要可以通过配置useUnfairLock属性为true使用非公平锁 
 | 
                maxWait: 60000 
 | 
                #配置间隔多久进行一次检测,检测需要关闭的空闲连接,单位毫秒。 默认是60s,太长可能会导致无法及时检测到连接中断 
 | 
                timeBetweenEvictionRunsMillis: 60000 
 | 
                #配置一个连接在连接池中的最小生存时间、最大生存时间,超过最大生存时间会被移除,单位毫秒。 
 | 
                minEvictableIdleTimeMillis: 300000 
 | 
                maxEvictableIdleTimeMillis: 900000 
 | 
                #探活、验证链接有效性的查询,新版本默认使用mysqlPing代替 
 | 
                #validation-query: select 1 #注释掉,采用默认的mysqlPing 
 | 
                #配置从连接池获取连接时,当连接空闲时间大于timeBetweenEvictionRunsMillis时是否检查连接有效性,true每次都检查;false不检查。 
 | 
                testWhileIdle: true 
 | 
                #配置从连接池获取连接时和向连接池归还连接时,是否检查连接有效性 
 | 
                #每次获取或归还连接都检测太频繁,除非特别重要或网络特别不可靠等情况,建议用testWhileIdle + timeBetweenEvictionRunsMillis代替。--> 
 | 
                testOnBorrow: false 
 | 
                testOnReturn: false 
 | 
                #配置是否定期探活、探活间隔, 默认120s 
 | 
                keepAlive: true 
 | 
                #keepAliveBetweenTimeMillis must be greater than timeBetweenEvictionRunsMillis 
 | 
                keepAliveBetweenTimeMillis: 1200000 
 | 
                #配置一个连接最大使用次数,避免长时间使用相同连接造成服务器端负载不均衡。 
 | 
                phyMaxUseCount: 1000 
 | 
                #是否缓存preparedStatement,也就是PSCache。PSCache对支持游标的数据库性能提升巨大,比如说oracle。在mysql下建议关闭。 
 | 
                poolPreparedStatements: false 
 | 
                #要启用PSCache,必须配置大于0,当大于0时,poolPreparedStatements自动触发修改为true。在Druid中,不会存在Oracle下PSCache占用内存过多的问题,可以把这个数值配置大一些,比如说100 
 | 
                maxOpenPreparedStatements: -1 
 | 
                #指定每个连接上PSCache的大小 
 | 
                maxPoolPreparedStatementPerConnectionSize: 20 
 | 
                #属性类型是字符串,通过别名的方式配置扩展插件,常用的插件有: 
 | 
                #监控统计用的filter:stat,日志用的filter:log4j,防御sql注入的filter:wall 
 | 
                #filters: stat,wall,config 
 | 
                filters: wall,config 
 | 
                webStatFilter: 
 | 
                    # 添加过滤规则 
 | 
                    urlPattern: /* 
 | 
                    # 忽略过滤格式 
 | 
                    exclusions: "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*" 
 | 
                    statViewServlet: 
 | 
                        # 设置ip白名单 
 | 
                        # allow: 127.0.0.1 
 | 
                        # 设置ip黑名单,优先级高于白名单 
 | 
                        deny: 
 | 
                        # 设置控制台管理用户 
 | 
                        #  loginUsername: root 
 | 
                        #  loginPassword: root 
 | 
                        # 是否可以重置数据 
 | 
                        resetEnable: false 
 | 
                        # 开启druid监控页面 
 | 
                        #enabled: true 
 | 
                        enabled: false 
 |