How to replace default hikari cp to tomcat pool on spring boot 2.0

后端 未结 3 1536
时光取名叫无心
时光取名叫无心 2021-02-07 20:47

I have migrated spring boot application to 2.0 and found out some problems with hikari connection pool. When I am fetching database data this results to hikari cp timeout ie. co

3条回答
  •  醉酒成梦
    2021-02-07 20:56

    I have found out the solution. This can be resolved in pom.xml by modifying like that:

    
        org.springframework.boot
        spring-boot-starter-jdbc
        
            
                com.zaxxer
                HikariCP
            
        
    
    
    
        org.apache.tomcat
        tomcat-jdbc
    
    

    However the hikari problem was probably with default small size of connection pool. So this problem could be resolved also with this change but not verified by myself. Just note for others. Something like that:

    spring.datasource.hikari.connection-timeout=60000
    spring.datasource.hikari.maximum-pool-size=5
    

提交回复
热议问题