Spring: Initialize multiple connection pools at startup

你。 提交于 2019-12-23 01:46:05

问题


I want to initialize multiple connection pools at context startup by reading connection parameters from a database table. Basically I want to address following two things

  1. Read connection properties from database not the properties file.

  2. Their are multiple connection pool(rows in db) details.

So my question is How can I iterate over list of rows returned by database in spring-context file and create multiple data-source objects and store them (Lets say in a map) with a unique key?

Databse table structure are somewhat like following:

+--------------+----------------+---------------+
| DBSERVERNAME | DBDRIVERCLASS  | DBMINPOOLSIZE |
+--------------+----------------+---------------+
| Server1      | Mysql-Driver   |            10 |
| Server2      | Oracle-Driver  |            20 |
| Server3      | DB2-Driver     |            10 |
+--------------+----------------+---------------+

Let me know if more details are needed. Thanks.

来源:https://stackoverflow.com/questions/29330592/spring-initialize-multiple-connection-pools-at-startup

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!