Spring DAO - first query with JdbcTemplate takes much longer time

前端 未结 3 812
天命终不由人
天命终不由人 2021-01-20 18:32

In my application I use Spring MVC with DAO pattern to access MSSql database with JdbcTemplate. Everything is working fine but I have noticed that first query takes a bit lo

3条回答
  •  北荒
    北荒 (楼主)
    2021-01-20 19:16

    Your DataSource is a connection pool. The first query needs to connect. Subsequent queries reuse the connection. You could either configure dbcp to pre-create a few connections or connect and release manually right after the app starts.

提交回复
热议问题