原文:https://github.com/x113773/testall/issues/11
### Druid 最近发布了1.1.0 版本,并且提供了 [druid-spring-boot-starter](https://github.com/alibaba/druid/tree/master/druid-spring-boot-starter),方便与Spring Boot集成
1. 首先添加依赖
```
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.1.0</version>
</dependency>
```
2. 然后配置[application.properties](https://github.com/x113773/testall/blob/master/src/main/resources/application.properties)
```
#JDBC
spring.datasource.url=jdbc:mysql://localhost:3306/testall?characterEncoding=utf8&useSSL=true
spring.datasource.username=root
spring.datasource.password=123qwe
spring.datasource.driver-class-name=com.mysql.jdbc.Driver #非必需
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource #非必需
# 连接池配置,下面配置说明请参考Druid Github Wiki,配置_DruidDataSource参考配置
spring.datasource.druid.initialSize=2
spring.datasource.druid.minIdle=2
spring.datasource.druid.maxActive=30
######Druid监控配置######
#下面配置说明请参考Druid Github Wiki,配置_配置WebStatFilter
spring.datasource.druid.WebStatFilter.exclusions=*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*
#下面配置说明请参考Druid Github Wiki,配置_StatViewServlet配置
spring.datasource.druid.StatViewServlet.loginUsername=druid
spring.datasource.druid.StatViewServlet.loginPassword=druid
```
更多配置,请参考[这里](https://github.com/alibaba/druid/blob/master/druid-spring-boot-starter/src/test/resources/config-template.properties)
---
接下来可以启动项目看看,访问http://localhost:8080/druid 首先输入上面配置的用户名和密码 druid 进行登录:
执行一个查询请求,然后查看SQL监控页面
![qq 20170629093628](https://user-images.githubusercontent.com/24689696/27667636-a4633650-5cae-11e7-852a-7bc43cd6672c.png)
查看数据源页面
![qq 20170629093548](https://user-images.githubusercontent.com/24689696/27667637-ab20ebae-5cae-11e7-822d-507989bb7485.png)