简体   繁体   中英

Change number of connection to database generated by a spring boot project

I have generated a spring boot project using jHipster. I want to reduce the number of connections to the database so I have modified the application-prod.yml file by adding the maximumPoolSize tag like this

datasource:
    type: com.zaxxer.hikari.HikariDataSource
    url: jdbc:mysql://localhost:3306/db?useUnicode=true&characterEncoding=utf8&useSSL=false
    username: root
    password:
    maximumPoolSize: 2

But when I try deploying the application I have 10 connections to the database. What am I doing wrong?

Thanks

With Spring Boot 1.4 the general properties have been reduced and moved to specific properties per DataSource provider (which is also explained in the reference guide and the release notes ).

So instead of using spring.datasource.maximumPoolSize you should be using spring.datasource.hikari.maximumPoolSize

For a list of properties see the appendix .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM