Better way to use HikariCP with Hibernate in Spring Boot Project
<p>I'm a beginner, I have a simple Spring Boot project, it's my first time using a connection pool (HikariCP in this case) and I need your help. It's working but I want to know if I'm using it the right way with Hibernate, or if there are better ways to do it, and if my Spring Boot project structure is correct.</p>

<p>EDIT : It's working even if I remove the class <code>HikariCPConfig</code>, how can I know if connection pools are working or not?</p>

<p>The project is as follow :</p>

<pre><code>- BankManager
   src/main/java
     |
     |__com.manager
        |__BankManagerApplication.java
        |__HikariCPConfig.java
     |__com.manager.dao
        |__ClientRepository.java
     |__com.manager.entities
        |__Client.java
     |__com.manager.service
        |__ClientServiceImpl.java
        |__ClientServiceInterface.java

   src/main/resources
     |__application.properties
</code></pre>

<p>BankManagerApplication.java :</p>

<pre><code>@SpringBootApplication

    public class BankManagerApplication {

        public static void main(String[] args) {    
            ApplicationContext ctx = SpringApplication.run(BankManagerApplication.class, args);
            ClientServiceInterface service = ctx.getBean(ClientServiceInterface.class);
            service.addClient(new Client("client1"));
            service.addClient(new Client("client2"));
            }
    }
</code></pre>

<p>HikariCPConfig.java :</p>

<pre><code>@Configuration
@ComponentScan
class HikariCPConfig {

   @Value("${spring.datasource.username}")
   private String user;

   @Value("${spring.datasource.password}")
   private String password;

   @Value("${spring.datasource.url}")
   private String dataSourceUrl;

   @Value("${spring.datasource.dataSourceClassName}")
   private String dataSourceClassName;

   @Value("${spring.datasource.poolName}")
   private String poolName;

   @Value("${spring.datasource.connectionTimeout}")
   private int connectionTimeout;

   @Value("${spring.datasource.maxLifetime}")
   private int maxLifetime;

   @Value("${spring.datasource.maximumPoolSize}")
   private int maximumPoolSize;

   @Value("${spring.datasource.minimumIdle}")
   private int minimumIdle;

   @Value("${spring.datasource.idleTimeout}")
   private int idleTimeout;

   @Bean
   public HikariDataSource primaryDataSource() {
       Properties dsProps = new Properties();
       dsProps.put("url", dataSourceUrl);
       dsProps.put("user", user);
       dsProps.put("password", password);
       dsProps.put("prepStmtCacheSize",250);
       dsProps.put("prepStmtCacheSqlLimit",2048);
       dsProps.put("cachePrepStmts",Boolean.TRUE);
       dsProps.put("useServerPrepStmts",Boolean.TRUE);

       Properties configProps = new Properties();
          configProps.put("dataSourceClassName", dataSourceClassName);
          configProps.put("poolName",poolName);
          configProps.put("maximumPoolSize",maximumPoolSize);
          configProps.put("minimumIdle",minimumIdle);
          configProps.put("minimumIdle",minimumIdle);
          configProps.put("connectionTimeout", connectionTimeout);
          configProps.put("idleTimeout", idleTimeout);
          configProps.put("dataSourceProperties", dsProps);

      HikariConfig hc = new HikariConfig(configProps);
      HikariDataSource ds = new HikariDataSource(hc);
      return ds;
   }
}
</code></pre>

<p>ClientServiceImpl.java</p>

<pre><code>@Service
public class ClientServiceImpl implements ClientServiceInterface {

    @Autowired
    ClientRepository clientRepository; // this class extends JPARepository

    @Override
    public Client addClient(Client c) {
        return clientRepository.save(c);
    }
}
</code></pre>

<p>application.properties :</p>

<pre><code>server.port = 8888
spring.jpa.databasePlatform=org.hibernate.dialect.MySQL5Dialect
spring.jpa.show-sql = true
spring.jpa.hibernate.ddl-auto = update

spring.datasource.dataSourceClassName=com.mysql.jdbc.jdbc2.optional.MysqlDataSource
spring.datasource.url=jdbc:mysql://localhost:3306/bank_manager
spring.datasource.username=root
spring.datasource.password=
spring.datasource.poolName=SpringBootHikariCP
spring.datasource.maximumPoolSize=5
spring.datasource.minimumIdle=3
spring.datasource.maxLifetime=2000000
spring.datasource.connectionTimeout=30000
spring.datasource.idleTimeout=30000
spring.datasource.pool-prepared-statements=true
spring.datasource.max-open-prepared-statements=250
</code></pre>

<p>Thank you in advance.</p>