Integrating hikaricp connection pool in spring


1、 Add related dependencies to the project

open pom.xml File, add the following two dependency configurations
1) Mysql database driven dependency

Integrating hikaricp connection pool in spring

2) JDBC support for spring objects (hikaricp connection pool will be downloaded by default)

Integrating hikaricp connection pool in spring

2、 Configure the hikarip connection pool

open Configuration file, add the following content (required)
Pay attention to the port number, do not write wrong!!!

3、 Hikaricp connection pool test

Add unit test classes and test methods to the project, as follows:
import java.sql.SQLException;
import javax.sql.DataSource;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

public class DataSourceTests {
    private DataSource dataSource;
    public void testConnection() throws Exception{

######Note: the package of datasource should not be misquoted!!! (this package is:javax.sql.DataSource