首先在maven中添加jar包依赖
<!-- https://mvnrepository.com/artifact/com.alibaba/druid-spring-boot-starter -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.1.10</version>
</dependency><!-- https://mvnrepository.com/artifact/com.alibaba/druid -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.1.10</version>
</dependency>
添加jar包依赖
spring:
datasource:
druid:
web-stat-filter:
enabled: true
url-pattern: /*
exclusions: /*.js,/*.gif,/*.jpg,/*.bmp,/*.png,/*.css,/*.ico,/druid/*
filter:
stat:
enabled: true
log-slow-sql: true
slow-sql-millis: 10000
merge-sql: true
aop-patterns: com.demo.shire.*
stat-view-servlet:
login-password: root
login-username: root
添加以后启动项目,在浏览器上输入 “项目地址” + druid/index.html