感谢作者:https://www.jianshu.com/p/e84e2709f383
一、添加Druid依赖
推荐使用 druid-spring-boot-starter
二、添加Druid配置
三、运行项目
可以看到我红色标注的地方, SpringBoot已经把Druid当作dataSource加载到项目中
那么我们现在访问用户列表地址: localhost:8080/user/list
再来看下IntelliJ IDEA工具控制台的输出日志, 如下:
这个sql是SpringDataJpa自动生成的, 我们已经完成了SpringBoot整合Druid连接, 接下来开启Druid监控功能.
一、创建Druid配置类
项目运行成功后, 我们要访问Durid的监控界面, 访问地址:http://localhost:8080/druid/login.html