引入依赖
1 2 3 4 5 6 7 8 9
| <dependency> <groupId>com.alibaba</groupId> <artifactId>druid-spring-boot-starter</artifactId> <version>1.2.23</version> </dependency> <dependency> <groupId>com.mysql</groupId> <artifactId>mysql-connector-j</artifactId> </dependency>
|
配置
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
| spring: datasource: type: com.alibaba.druid.pool.DruidDataSource driver-class-name: com.mysql.cj.jdbc.Driver url: jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=UTF-8&useSSL=false username: root password: root druid: stat-view-servlet: enabled: true url-pattern: /druid/* reset-enable: false login-username: root login-password: root allow: deny: web-stat-filter: enabled: true exclusions: "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*" url-pattern: /* session-stat-enable: false filter: wall: enabled: true stat: enabled: true log-slow-sql: true merge-sql: true
|
访问
http://localhost:9000/druid