3. Connection Pool - Alibaba Druid and Google Guava
Contents
Druid is a database connection pool component developed by Alibaba middleware team. It includes powerful connection pool monitoring features.
Add Dependencies
Add Druid dependency into pom.xml
|
|
Add Guava dependency into pom.xml
|
|
Comment and Add Properties
Comment Previous Data Source Properties
Comment out previous data source properties in the application.properties file:
|
|
Add Druid Data Source Properties
Add Druid data source properties into application.properties file:
|
|
Create Druid Config Class
- Right click java directory: New > Package
- Fill in: co.dongchen.shop.config
- Click “OK” button
- Right click co.dongchen.shop.config directory: New > Java Class
- Fill in: DruidConfig
- Click “OK” button
Copy and paste the following content into DruidConfig.java:
|
|
Verify
Run the App
|
|
Choose the correspondent option and press enter.
View Druid Monitoring Dashboard in the Browser
|
|
It might be a Chinese Simplified version, if so, please click the “English” linkage at the top right of the page:
References Alibaba Druid, Google Guava
Author Dong Chen
LastMod Fri Apr 26 2019