springboot和druid整合的时候出现404错误

!](https://img-blog.csdnimg.cn/2021031210371650.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NTI1NTY0NQ==,size_16,color_FFFFFF,t_70)
springboot整合druid的时候出现了一个坑,这个坑踩了2个多小时。
在这里插入图片描述
出现这个问题的原因是因为yml中的配置不完全。
我的yml文件是这样的

  datasource:
    name: druidDataSource
    type: com.alibaba.druid.pool.DruidDataSource
    druid:
      driver-class-name: com.mysql.cj.jdbc.Driver
      url: jdbc:mysql://localhost:3306/jk?serverTimezone=GMT%2B8&amp&useSSL=false
      username: root
      password: 123456
      filters: stat,wall,log4j,config
      max-active: 100
      initial-size: 1
      max-wait: 60000
      min-idle: 1
      time-between-eviction-runs-millis: 60000
      min-evictable-idle-time-millis: 300000
      validation-query: select 'x'
      test-while-idle: true
      test-on-borrow: false
      test-on-return: false
      pool-prepared-statements: true
      max-open-prepared-statements: 50
      max-pool-prepared-statement-per-connection-size: 20
    
在这里插入代码片

只需要加上下面这个就行了。

在这里插入图片描述

加上之后就没有问题
在这里插入图片描述


版权声明:本文为weixin_45255645原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。