springboot1.5.4 configuration druid1.1.0 (using Druid-spring-boot-starter)

Source: Internet
Author: User

Original: HTTPS://GITHUB.COM/X113773/TESTALL/ISSUES/11

# # # Druid recently released 1.1.0 version and provided [Druid-spring-boot-starter] (https://github.com/alibaba/druid/tree/master/ Druid-spring-boot-starter) for easy integration with spring boot

1. First add a dependency
```
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.1.0</version>
</dependency>
```
2. Then configure [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 #非必需

# Connection Pool configuration, please refer to Druid Github Wiki, configuring _druiddatasource reference configuration for the following configuration instructions
spring.datasource.druid.initialsize=2
spring.datasource.druid.minidle=2
Spring.datasource.druid.maxactive=30

##### #Druid监控配置 ######
#下面配置说明请参考Druid Github Wiki, configure Webstatfilter
spring.datasource.druid.webstatfilter.exclusions=*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*

#下面配置说明请参考Druid Github Wiki, configure _statviewservlet configuration
Spring.datasource.druid.statviewservlet.loginusername=druid
Spring.datasource.druid.statviewservlet.loginpassword=druid
```
For more configuration, please refer to [here] (https://github.com/alibaba/druid/blob/master/druid-spring-boot-starter/src/test/resources/ Config-template.properties)

---
Next you can start the project to see, Access Http://localhost:8080/druid first enter the user name and password configured above druid to log in:

Execute a query request, and then view the SQL monitoring page
! [QQ 20170629093628] (https://user-images.githubusercontent.com/24689696/27667636-a4633650-5cae-11e7-852a-7bc43cd6672c.png)

View Data source page
! [QQ 20170629093548] (https://user-images.githubusercontent.com/24689696/27667637-ab20ebae-5cae-11e7-822d-507989bb7485.png)

springboot1.5.4 configuration druid1.1.0 (using Druid-spring-boot-starter)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.