Spring boot using Druid

Druid is the best database connection pool in the Java language and can provide powerful monitoring and extension functions. Here is how to configure and use Druid in springboot. Steps:

1. In POM Loading dependencies in XML

2. In application Add data source configuration in properties

3. Write druidconfiguration and inject Druid servlet and filter through @ bean annotation to provide access to monitoring pages

4. Browser access

1、 In POM Adding dependencies to XML

2、 In application Add data source configuration in properties

The above is the configuration information in my project. Just focus on the datasource part.

3、 Write the druidconfiguration configuration class and inject the Druid servlet and filter through @ bean annotation to provide access to the monitoring page

4、 Browser access

Enter in the browser http://localhost:8080/druid/index.html , you need to log in with your account and password for the first time

In the data source column, all marked with "*" cannot be empty, especially the filter class name, otherwise the SQL monitoring data will not be visible.

5、 View SQL monitoring

After deleting a record, view SQL monitoring

At this point, we have successfully configured Druid.

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>